Skip to content

Commit

Permalink
Merge pull request #17 from mattwthompson/fix-ordering
Browse files Browse the repository at this point in the history
Fix possible typo in ordering
  • Loading branch information
mattwthompson authored Feb 16, 2024
2 parents 1891e82 + 473d7f2 commit 15b79cc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ibstore/_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def get_mm_energies_by_molecule_id(
for (energy,) in db.db.query(DBMMConformerRecord.energy)
.filter_by(parent_id=id)
.filter_by(force_field=force_field)
.order_by(DBQMConformerRecord.qcarchive_id)
.order_by(DBMMConformerRecord.qcarchive_id)
.all()
]

Expand Down
32 changes: 32 additions & 0 deletions ibstore/_tests/unit_tests/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,35 @@ def test_get_qm_conformer_records_by_molecule_id(small_store, diphenylvinylbenze
assert Molecule.from_mapped_smiles(record.mapped_smiles).is_isomorphic_with(
diphenylvinylbenzene,
)


@pytest.mark.parametrize(("molecule_id", "expected_len"), [(28, 1), (40, 9)])
def test_get_mm_energies_by_molecule_id(
small_store,
molecule_id,
expected_len,
):
"""Trigger issue #16."""
energies = small_store.get_mm_energies_by_molecule_id(
molecule_id,
force_field="openff-2.0.0",
)

for energy in energies:
assert isinstance(energy, float)

assert len(energies) == expected_len


@pytest.mark.parametrize(("molecule_id", "expected_len"), [(28, 1), (40, 9)])
def test_get_qm_energies_by_molecule_id(
small_store,
molecule_id,
expected_len,
):
energies = small_store.get_qm_energies_by_molecule_id(molecule_id)

for energy in energies:
assert isinstance(energy, float)

assert len(energies) == expected_len
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude =
[coverage:run]
omit =
*/_version.py
*/tests/*
*/_tests/*
ibstore/_version.py

[coverage:report]
Expand Down

0 comments on commit 15b79cc

Please sign in to comment.