Skip to content

Commit

Permalink
Added core properties to test_to_from_rdkit. Partway through
Browse files Browse the repository at this point in the history
implementing/debugging stereochemistry in RDKit conversions.
  • Loading branch information
j-wags committed Nov 9, 2018
1 parent 730877e commit 0d29212
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 123 deletions.
19 changes: 11 additions & 8 deletions openforcefield/tests/test_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ def test_name(self):
molecule.name = name
assert molecule.name == name

# TODO: This should be a toolkit test
#@pytest.mark.skipif(OPENEYE_UNAVAILABLE, reason=_OPENEYE_UNAVAILABLE_MESSAGE)
@OpenEyeToolkitWrapper.requires_toolkit()
def test_iupac_roundtrip(self):
Expand All @@ -600,6 +601,7 @@ def test_topology_roundtrip(self):
molecule_copy = Molecule.from_topology(topology)
assert molecule == molecule_copy

# TODO: This should be a toolkit test
def test_file_roundtrip(self):
"""Test to/from file"""
import os
Expand All @@ -626,15 +628,16 @@ def test_file_roundtrip(self):
# NOTE: We can't read pdb files and expect chemical information to be preserved
os.unlink(iofile.name)

# Really big round-trip tests have now been added to test_toolkits and aren't necessary here
#@pytest.mark.skipif(RDKIT_UNAVAILABLE, reason=_RDKIT_UNAVAILABLE_MESSAGE)
@RDKitToolkitWrapper.requires_toolkit()
def test_rdkit_roundtrip(self):
for molecule in self.molecules:
rdmol = molecule.to_rdkit()
molecule2 = Molecule.from_rdkit(rdmol)
assert_molecule_is_equal(molecule, molecule2, "Molecule.to_rdkit()/from_rdkit() round trip failed")
molecule3 = Molecule(rdmol)
assert_molecule_is_equal(molecule, molecule3, "Molecule(rdmol) constructor failed")
##@RDKitToolkitWrapper.requires_toolkit()
#def test_rdkit_roundtrip(self):
# for molecule in self.molecules:
# rdmol = molecule.to_rdkit()
# molecule2 = Molecule.from_rdkit(rdmol)
3 assert_molecule_is_equal(molecule, molecule2, "Molecule.to_rdkit()/from_rdkit() round trip failed")
# molecule3 = Molecule(rdmol)
# assert_molecule_is_equal(molecule, molecule3, "Molecule(rdmol) constructor failed")

#@pytest.mark.skipif(OPENEYE_UNAVAILABLE, reason=_OPENEYE_UNAVAILABLE_MESSAGE)
@OpenEyeToolkitWrapper.requires_toolkit()
Expand Down
Loading

0 comments on commit 0d29212

Please sign in to comment.