Skip to content

Commit

Permalink
Merge pull request #585 from tcjaffe/stabilize-pubchem-test
Browse files Browse the repository at this point in the history
Stabilize test_pubchem/test_search_simple
  • Loading branch information
padix-key authored Jun 6, 2024
2 parents 875e844 + cdf3414 commit 43e6b1f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/database/test_pubchem.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_fetch_invalid():
@pytest.mark.parametrize(
"query, ref_ids",
[
(pubchem.NameQuery("Alanine"), [602, 5950, 71080]),
(pubchem.NameQuery("Alanine"), [5950]),
(pubchem.SmilesQuery("CCCC"), [7843]),
(pubchem.InchiQuery("InChI=1S/C4H10/c1-3-4-2/h3-4H2,1-2H3"), [7843]),
(pubchem.InchiKeyQuery("IJDNQMDRQITEOD-UHFFFAOYSA-N"), [7843]),
Expand All @@ -95,7 +95,11 @@ def test_search_simple(query, ref_ids):
"""
Checks for the simpler `Query` types, where the output is known.
"""
assert set(pubchem.search(query)) == set(ref_ids)
# NOTE: The full set of ref ids returned by pubchem routinely changes.
# For this reason, we check that the expected ref_ids set is
# a subset of the actual set. The expected ref_ids set should
# be stable over time.
assert set(ref_ids).issubset(pubchem.search(query))


@pytest.mark.skipif(
Expand Down

0 comments on commit 43e6b1f

Please sign in to comment.