Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,22 @@ Befor running any test you have to build and install indigo-python
python api/tests/integration/test.py -t 1 -p test_name
```

>to update all tests "ref/" using -u flag
```
python api/tests/integration/test.py -u
```

>to update all tests "ref/" without -u flag
```
export INDIGO_UPDATE_TESTS="True"
python api/tests/integration/test.py
```

>to update a single test's "ref/" by mask use `test_name` and -u flag
```
python api/tests/integration/test.py -t 1 -p test_name -u
```

### To run backend API test:
1) Build and install indigo-python
2) Set environment variable by running this command:
Expand Down
10 changes: 6 additions & 4 deletions api/tests/integration/common/env_indigo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Setup enviroment for using Indigo both for Python, Jython and IronPython
import inspect
import io
import os
import shutil
import sys
Expand Down Expand Up @@ -209,7 +210,7 @@ def moleculeLayoutDiff(
ref,
delta=0.01,
ref_is_file=True,
update=False,
update=os.getenv("INDIGO_UPDATE_TESTS", "False") == "True",
update_format="mol",
):
if ref_is_file:
Expand All @@ -219,7 +220,7 @@ def moleculeLayoutDiff(
txt = mol.molfile()
elif update_format == "ket":
txt = mol.json()
with open(ref_name, "w") as file:
with io.open(ref_name, "w", encoding="utf-8") as file:
file.write(txt)
m2 = indigo.loadMoleculeFromFile(ref_name)
else:
Expand Down Expand Up @@ -268,7 +269,7 @@ def reactionLayoutDiff(
ref,
delta=0.001,
ref_is_file=True,
update=False,
update=os.getenv("INDIGO_UPDATE_TESTS", "False") == "True",
update_format="mol",
):
if ref_is_file:
Expand All @@ -278,7 +279,7 @@ def reactionLayoutDiff(
txt = rxn.rxnfile()
elif update_format == "ket":
txt = rxn.json()
with open(ref_name, "w") as file:
with io.open(ref_name, "w", encoding="utf-8") as file:
file.write(txt)
r2 = indigo.loadReactionFromFile(ref_name)
else:
Expand All @@ -297,6 +298,7 @@ def reactionLayoutDiff(
r2.getMolecule(m.index()).molfile(),
delta,
ref_is_file=False,
update=False,
)
error_buf.append("Molecule #{}: {}".format(m.index(), res))
return "\n ".join(error_buf)
Expand Down
29 changes: 29 additions & 0 deletions api/tests/integration/common/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import difflib
import io
import os
import platform
import re
Expand Down Expand Up @@ -207,3 +209,30 @@ def check_jna_sha1():
except Exception as e:
os.remove(output_path)
raise e


def find_diff(a, b):
return "\n".join(difflib.unified_diff(a.splitlines(), b.splitlines()))


def compare_diff(ref_path, filename, data, stdout=True, diff_fn=find_diff):
path_to_file = os.path.join(ref_path, filename)

is_update_required = os.getenv("INDIGO_UPDATE_TESTS", "False") == "True"
if is_update_required:
with io.open(path_to_file, "w", encoding="utf-8") as file:
file.write(data)

with io.open(path_to_file, "r", encoding="utf-8") as file:
data_ref = file.read()

diff = diff_fn(data_ref, data)

if not stdout:
return diff

if not diff:
print(filename + ":SUCCEED")
else:
print(filename + ":FAILED")
print(diff)
4 changes: 2 additions & 2 deletions api/tests/integration/ref/formats/2713-star-atom.py.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*** 2713 star atom support ***
star_atom ket : SUCCEED
star_atom scxmiles : SUCCEED
star_atom.ket:SUCCEED
*C.*N.*O |$star_e;;AH_p;;star_e;$|
70 changes: 35 additions & 35 deletions api/tests/integration/ref/formats/cdx_export.py.out
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
*** Mol to CDX ***
enhanced_stereo1:success
enhanced_stereo2:success
enhanced_stereo3:success
macro/sa-mono:success
rgroup:success
stereo_either-0020:success
two_bn:success
enhanced_stereo1.b64cdx:SUCCEED
enhanced_stereo2.b64cdx:SUCCEED
enhanced_stereo3.b64cdx:SUCCEED
macro/sa-mono.b64cdx:SUCCEED
rgroup.b64cdx:SUCCEED
stereo_either-0020.b64cdx:SUCCEED
two_bn.b64cdx:SUCCEED
*** KET to CDX ***
issue_1774:success
issue_1775:success
issue_1774.b64cdx:SUCCEED
issue_1775.b64cdx:SUCCEED
molecule json loader: 'any' bonds are allowed only for queries
*** Try as Query ***
CDXML loader: Queries not supported
issue_1777:success
agents:success
issue_1777.b64cdx:SUCCEED
agents.b64cdx:SUCCEED
*** CDXML to CDX ***
AlcoholOxidation_Rxn1:success
AlcoholOxidation_Rxn2:success
Amidation_Rxn1:success
Amidation_Rxn2:success
BuchwaldHartwig_Rxn1:success
BuchwaldHartwig_Rxn2:success
CarbonylReduction_Rxn1:success
CarbonylReduction_Rxn2:success
Esterification_Rxn1:success
Esterification_Rxn2:success
Grignard_Rxn1:success
Grignard_Rxn2:success
N-Alkylation_Rxn1:success
N-Alkylation_Rxn2:success
N-Sulfonylation_Rxn1:success
N-Sulfonylation_Rxn2:success
O-Alkylation_Rxn1:success
O-Alkylation_Rxn2:success
Reductive Amination_Rxn1:success
Reductive Amination_Rxn2:success
SnAr_Rxn1:success
SnAr_Rxn2:success
Suzuki_Rxn1:success
Suzuki_Rxn2:success
AlcoholOxidation_Rxn1.b64cdx:SUCCEED
AlcoholOxidation_Rxn2.b64cdx:SUCCEED
Amidation_Rxn1.b64cdx:SUCCEED
Amidation_Rxn2.b64cdx:SUCCEED
BuchwaldHartwig_Rxn1.b64cdx:SUCCEED
BuchwaldHartwig_Rxn2.b64cdx:SUCCEED
CarbonylReduction_Rxn1.b64cdx:SUCCEED
CarbonylReduction_Rxn2.b64cdx:SUCCEED
Esterification_Rxn1.b64cdx:SUCCEED
Esterification_Rxn2.b64cdx:SUCCEED
Grignard_Rxn1.b64cdx:SUCCEED
Grignard_Rxn2.b64cdx:SUCCEED
N-Alkylation_Rxn1.b64cdx:SUCCEED
N-Alkylation_Rxn2.b64cdx:SUCCEED
N-Sulfonylation_Rxn1.b64cdx:SUCCEED
N-Sulfonylation_Rxn2.b64cdx:SUCCEED
O-Alkylation_Rxn1.b64cdx:SUCCEED
O-Alkylation_Rxn2.b64cdx:SUCCEED
Reductive Amination_Rxn1.b64cdx:SUCCEED
Reductive Amination_Rxn2.b64cdx:SUCCEED
SnAr_Rxn1.b64cdx:SUCCEED
SnAr_Rxn2.b64cdx:SUCCEED
Suzuki_Rxn1.b64cdx:SUCCEED
Suzuki_Rxn2.b64cdx:SUCCEED
6 changes: 3 additions & 3 deletions api/tests/integration/ref/formats/genbank_to_seq.py.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** GenBank/GenPept to Seq***
1844-gen_bank.seq.seq:SUCCEED
1844-gen_pept.seq.seq:SUCCEED
2763-gen_spaces.seq.seq:SUCCEED
1844-gen_bank.seq:SUCCEED
1844-gen_pept.seq:SUCCEED
2763-gen_spaces.seq:SUCCEED
46 changes: 23 additions & 23 deletions api/tests/integration/ref/formats/ket_to_ket.py.out
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
*** KET to KET ***
3087-star-process.ket:SUCCEED
images.ket:SUCCEED
ambiguous_monomer.ket doc loadKetDocument: SUCCEED
ambiguous_monomer.ket mol loadMolecule: SUCCEED
ambiguous_monomer.ket mol loadQueryMolecule: SUCCEED
expanded_monomer.ket doc loadKetDocument: SUCCEED
expanded_monomer.ket mol loadMolecule: SUCCEED
expanded_monomer.ket mol loadQueryMolecule: SUCCEED
helm_alias.ket doc loadKetDocument: SUCCEED
helm_alias.ket mol loadMolecule: SUCCEED
helm_alias.ket mol loadQueryMolecule: SUCCEED
helm_annotation.ket doc loadKetDocument: SUCCEED
helm_annotation.ket mol loadMolecule: SUCCEED
helm_annotation.ket mol loadQueryMolecule: SUCCEED
modification_types.ket doc loadKetDocument: SUCCEED
modification_types.ket mol loadMolecule: SUCCEED
modification_types.ket mol loadQueryMolecule: SUCCEED
monomer_shape.ket doc loadKetDocument: SUCCEED
monomer_shape.ket mol loadMolecule: SUCCEED
monomer_shape.ket mol loadQueryMolecule: SUCCEED
monomer_transform.ket doc loadKetDocument: SUCCEED
monomer_transform.ket mol loadMolecule: SUCCEED
monomer_transform.ket mol loadQueryMolecule: SUCCEED
2707_subst_count.ket ket: SUCCEED
2707_subst_count.ket mol: SUCCEED
ambiguous_monomer_doc.ket loadKetDocument:SUCCEED
ambiguous_monomer_mol.ket loadMolecule:SUCCEED
ambiguous_monomer_mol.ket loadQueryMolecule:SUCCEED
expanded_monomer_doc.ket loadKetDocument:SUCCEED
expanded_monomer_mol.ket loadMolecule:SUCCEED
expanded_monomer_mol.ket loadQueryMolecule:SUCCEED
helm_alias_doc.ket loadKetDocument:SUCCEED
helm_alias_mol.ket loadMolecule:SUCCEED
helm_alias_mol.ket loadQueryMolecule:SUCCEED
helm_annotation_doc.ket loadKetDocument:SUCCEED
helm_annotation_mol.ket loadMolecule:SUCCEED
helm_annotation_mol.ket loadQueryMolecule:SUCCEED
modification_types_doc.ket loadKetDocument:SUCCEED
modification_types_mol.ket loadMolecule:SUCCEED
modification_types_mol.ket loadQueryMolecule:SUCCEED
monomer_shape_doc.ket loadKetDocument:SUCCEED
monomer_shape_mol.ket loadMolecule:SUCCEED
monomer_shape_mol.ket loadQueryMolecule:SUCCEED
monomer_transform_doc.ket loadKetDocument:SUCCEED
monomer_transform_mol.ket loadMolecule:SUCCEED
monomer_transform_mol.ket loadQueryMolecule:SUCCEED
2707_subst_count.ket:SUCCEED
2707_subst_count.mol:SUCCEED
3069-reaction.ket:SUCCEED
multi_merge4.ket:SUCCEED
mixed_reaction.ket:SUCCEED
Expand Down
116 changes: 58 additions & 58 deletions api/tests/integration/ref/formats/ket_to_mol.py.out
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
*** KET to MOL ***
3068-star-issue.ket:SUCCEED
3178-any-bond.ket:SUCCEED
3227-copolymer.ket:SUCCEED
3343-dir-expanded.ket:SUCCEED
5amd.ket:SUCCEED
accl_no_class.ket:SUCCEED
acgt_1412.ket:SUCCEED
anacyclamide.ket:SUCCEED
chem.ket:SUCCEED
chem_rna_hydro.ket:SUCCEED
conj_no_class.ket:SUCCEED
conjugate.ket:SUCCEED
cysteine.ket:SUCCEED
dala.ket:SUCCEED
dcysteine.ket:SUCCEED
dna_mod.ket:SUCCEED
dthymine.ket:SUCCEED
exp-valence-0.ket:SUCCEED
flip_rotate.ket:SUCCEED
flip_rotate_2000.ket:SUCCEED
flip_rotate_rna.ket:SUCCEED
fmoc.ket:SUCCEED
hydro_atp_ch.ket:SUCCEED
issue_1476.ket:SUCCEED
issue_2699_rlogic.ket:SUCCEED
issue_2702.ket:SUCCEED
macro/R2R3R4.ket:SUCCEED
macro/conjugates/pep-chem-rna.ket:SUCCEED
macro/conjugates/peptide_rna.ket:SUCCEED
macro/dendromers/dendro-peptide.ket:SUCCEED
macro/disulfide/disulfide_peptide_cycle.ket:SUCCEED
macro/hundred-monomers.ket:SUCCEED
macro/left_phosphate/left_phosphate.ket:SUCCEED
macro/linear/linear_dna.ket:SUCCEED
macro/linear/linear_multi.ket:SUCCEED
macro/linear/linear_peptide.ket:SUCCEED
macro/linear/linear_rna.ket:SUCCEED
macro/modified/mod_dna.ket:SUCCEED
macro/modified/mod_peptide.ket:SUCCEED
macro/modified/mod_rna.ket:SUCCEED
macro/modified/mod_rna_peptide.ket:SUCCEED
macro/peptide-rna/peptide-rna.ket:SUCCEED
macro/peptide-rna/peptide-rna-ac.ket:SUCCEED
macro/polyphosphate/polyphosphate_rna.ket:SUCCEED
macro/sa-mono.ket:SUCCEED
macro/terminators/terms_peptide.ket:SUCCEED
mon_long_id.ket:SUCCEED
pepchem.ket:SUCCEED
peptides.ket:SUCCEED
query_explicit_val.ket:SUCCEED
rna_mod.ket:SUCCEED
sgroup_class.ket:SUCCEED
sgroups_mul.ket:SUCCEED
suplabel.ket:SUCCEED
taspoglutide.ket:SUCCEED
thymine.ket:SUCCEED
empty_apid.ket:SUCCEED
ket-reaction-arrow.ket:SUCCEED
3068-star-issue.mol:SUCCEED
3178-any-bond.mol:SUCCEED
3227-copolymer.mol:SUCCEED
3343-dir-expanded.mol:SUCCEED
5amd.mol:SUCCEED
accl_no_class.mol:SUCCEED
acgt_1412.mol:SUCCEED
anacyclamide.mol:SUCCEED
chem.mol:SUCCEED
chem_rna_hydro.mol:SUCCEED
conj_no_class.mol:SUCCEED
conjugate.mol:SUCCEED
cysteine.mol:SUCCEED
dala.mol:SUCCEED
dcysteine.mol:SUCCEED
dna_mod.mol:SUCCEED
dthymine.mol:SUCCEED
exp-valence-0.mol:SUCCEED
flip_rotate.mol:SUCCEED
flip_rotate_2000.mol:SUCCEED
flip_rotate_rna.mol:SUCCEED
fmoc.mol:SUCCEED
hydro_atp_ch.mol:SUCCEED
issue_1476.mol:SUCCEED
issue_2699_rlogic.mol:SUCCEED
issue_2702.mol:SUCCEED
macro/R2R3R4.mol:SUCCEED
macro/conjugates/pep-chem-rna.mol:SUCCEED
macro/conjugates/peptide_rna.mol:SUCCEED
macro/dendromers/dendro-peptide.mol:SUCCEED
macro/disulfide/disulfide_peptide_cycle.mol:SUCCEED
macro/hundred-monomers.mol:SUCCEED
macro/left_phosphate/left_phosphate.mol:SUCCEED
macro/linear/linear_dna.mol:SUCCEED
macro/linear/linear_multi.mol:SUCCEED
macro/linear/linear_peptide.mol:SUCCEED
macro/linear/linear_rna.mol:SUCCEED
macro/modified/mod_dna.mol:SUCCEED
macro/modified/mod_peptide.mol:SUCCEED
macro/modified/mod_rna.mol:SUCCEED
macro/modified/mod_rna_peptide.mol:SUCCEED
macro/peptide-rna/peptide-rna.mol:SUCCEED
macro/peptide-rna/peptide-rna-ac.mol:SUCCEED
macro/polyphosphate/polyphosphate_rna.mol:SUCCEED
macro/sa-mono.mol:SUCCEED
macro/terminators/terms_peptide.mol:SUCCEED
mon_long_id.mol:SUCCEED
pepchem.mol:SUCCEED
peptides.mol:SUCCEED
query_explicit_val.mol:SUCCEED
rna_mod.mol:SUCCEED
sgroup_class.mol:SUCCEED
sgroups_mul.mol:SUCCEED
suplabel.mol:SUCCEED
taspoglutide.mol:SUCCEED
thymine.mol:SUCCEED
empty_apid.mol:SUCCEED
ket-reaction-arrow.mol:SUCCEED
2 changes: 1 addition & 1 deletion api/tests/integration/ref/formats/ket_to_seq3letter.py.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** KET to 3 LETTER SEQUENCE ***
peptides_3letter : SUCCEED
peptides_3letter.seq3:SUCCEED
Test 'issue_3200': got expected error 'Only amino acids can be saved as three letter amino acid codes'
Test 'peptides_molecule': got expected error 'Sequence saver: Can't save micro-molecules to sequence format'
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*** KET to MOL ***
ket_with_mult_group.ket:SUCCEED
ket_with_mult_group.mol:SUCCEED
Loading
Loading