Skip to content
Snippets Groups Projects
Commit c6d1c13f authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add unit test for smi2sdf utils function

parent edb1b918
No related branches found
No related tags found
1 merge request!13Master
......@@ -26,7 +26,7 @@ from .models import (
PcaBiplotData,
)
from .models import DrugBankCompound, Protein
from .utils import FingerPrinter, mol2smi, smi2mol, smi2inchi, smi2inchikey
from .utils import FingerPrinter, mol2smi, smi2mol, smi2inchi, smi2inchikey, smi2sdf
class MolSmiTestCase(TestCase):
......@@ -918,6 +918,30 @@ class TestConvertSMILESToIUPAC(TestCase):
)
class TestConvertSMILESToSDF(TestCase):
"""
Test converting a smiles to SDF using openbabel
"""
def test_valid(self):
smiles_to_sdfs = {
"C": [
"1",
" OpenBabel04142011372D",
"",
" 1 0 0 0 0 0 0 0 0 0999 V2000",
" 0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0",
"M END",
"$$$$",
]
}
for smiles, expected_lines in smiles_to_sdfs.items():
result = smi2sdf({1: smiles})
result_lines = result.split("\n")
for line_idx in [0, 2, 3, 4, 5, 6]:
self.assertEqual(result_lines[line_idx], expected_lines[line_idx])
class DuplicateGeneNameTestCase(TestCase):
def test_works(self):
models.Protein.objects.get_or_create(uniprot_id="P12497")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment