-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |