Skip to content

Commit c39dc45

Browse files
committed
test(test_RP2.py): test check_inchi_from_file
1 parent c8552a0 commit c39dc45

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/test_RP2.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
__KNIME_VER__,
1818
__RETROPATH2_KWF__,
1919
set_vars,
20-
gunzip_to_csv
20+
gunzip_to_csv,
21+
check_inchi_from_file
2122
)
2223
from retropath2_wrapper.__main__ import create_logger
2324

@@ -126,3 +127,23 @@ def test_set_vars_None(self):
126127
# self.outdir,
127128
# dmin=16)
128129
# self.assertTrue(cmp(result, self.ref_file))
130+
131+
132+
class TestMethods:
133+
134+
def test_check_inchi_from_file(self, tmpdir):
135+
inchis = [
136+
'InChI=1S/C3H6O/c1-3(2)4/h1-2H3',
137+
'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+',
138+
'InChI=1S/H2O2/c1-2/h1-2H',
139+
'InChI=1S/C4H10O/c1-4(2)3-5/h4-5H,3H2,1-2H3'
140+
]
141+
for inchi in inchis:
142+
tmp_file = Path(tmpdir) / 'source.csv'
143+
with open(tmp_file, 'w') as fh:
144+
fh.write('"Name","InChI"\n')
145+
fh.write(f'"target","{inchi}"')
146+
try:
147+
assert check_inchi_from_file(tmp_file) != ''
148+
except AssertionError as e:
149+
raise e

0 commit comments

Comments
 (0)