Skip to content

Commit

Permalink
Fix tests for CAS normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Jun 9, 2020
1 parent cbb4c04 commit ac0d81f
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions tests/strategies/matching.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
from bw_recipe_2016.strategies.matching import match_cas_number, normalized_cas
from bw_recipe_2016.chemidplus import canonical_cas


def test_normalized_cas():
assert normalized_cas(7440473) == normalized_cas(7440473.0)
assert normalized_cas(7440473) == normalized_cas("7440-47-3")
assert normalized_cas("7440-47-3") == normalized_cas("0007440-47-3")


# def match_cas_number(data, other):
# """Match based on `CAS number <https://en.wikipedia.org/wiki/CAS_Registry_Number>`. Uses the key ``CAS number`` for elements in both ``data`` and ``other``."""
# lookup = {normalized_cas[elem["CAS number"]]: elem.key for elem in other if "CAS number" in elem}
# for ds in data:
# for cf in unlinked(ds['exchanges']):
# try:
# cf['input'] = lookup(cf['CAS number'])
# except KeyError:
# pass
# return data
assert canonical_cas(7440473) == canonical_cas(7440473.0)
assert canonical_cas(7440473) == canonical_cas("7440-47-3")
assert canonical_cas("7440-47-3") == canonical_cas("0007440-47-3")

0 comments on commit ac0d81f

Please sign in to comment.