Skip to content

Commit

Permalink
test(test_RP2.py): test check_inchi_from_file
Browse files Browse the repository at this point in the history
  • Loading branch information
tduigou committed Dec 17, 2021
1 parent c8552a0 commit c39dc45
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/test_RP2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
__KNIME_VER__,
__RETROPATH2_KWF__,
set_vars,
gunzip_to_csv
gunzip_to_csv,
check_inchi_from_file
)
from retropath2_wrapper.__main__ import create_logger

Expand Down Expand Up @@ -126,3 +127,23 @@ def test_set_vars_None(self):
# self.outdir,
# dmin=16)
# self.assertTrue(cmp(result, self.ref_file))


class TestMethods:

def test_check_inchi_from_file(self, tmpdir):
inchis = [
'InChI=1S/C3H6O/c1-3(2)4/h1-2H3',
'InChI=1S/C14H12O3/c15-12-5-3-10(4-6-12)1-2-11-7-13(16)9-14(17)8-11/h1-9,15-17H/b2-1+',
'InChI=1S/H2O2/c1-2/h1-2H',
'InChI=1S/C4H10O/c1-4(2)3-5/h4-5H,3H2,1-2H3'
]
for inchi in inchis:
tmp_file = Path(tmpdir) / 'source.csv'
with open(tmp_file, 'w') as fh:
fh.write('"Name","InChI"\n')
fh.write(f'"target","{inchi}"')
try:
assert check_inchi_from_file(tmp_file) != ''
except AssertionError as e:
raise e

0 comments on commit c39dc45

Please sign in to comment.