Skip to content

Commit

Permalink
Merge pull request #23 from Albericvgn/fane
Browse files Browse the repository at this point in the history
anotha one
  • Loading branch information
faneshala authored May 26, 2024
2 parents 9747284 + f622de0 commit 0c1e36e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_get_molecular_formula.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import unittest
from rdkit import Chem
from rdkit.Chem import rdMolDescriptors
import sys
import os

try:
current_dir = os.path.dirname(os.path.abspath(__file__))
except NameError:
current_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
src_path = os.path.join(current_dir, '..', 'src')
sys.path.insert(0, src_path)

from chembalancer.chembalancer import get_molecular_formula



class TestChemFunctions(unittest.TestCase):
def test_valid_smiles(self):
# Test with a valid SMILES string for water
self.assertEqual(get_molecular_formula('O'), 'H2O')

def test_invalid_smiles(self):
# Test with an invalid SMILES string
self.assertEqual(get_molecular_formula('XYZ'), 'Invalid SMILES string')

def test_another_valid_smiles(self):
# Test with a valid SMILES string for benzene
self.assertEqual(get_molecular_formula('C1=CC=CC=C1'), 'C6H6')

if __name__ == '__main__':
unittest.main()

0 comments on commit 0c1e36e

Please sign in to comment.