-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Albericvgn/fane
anotha one
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |