File size: 985 Bytes
83db774
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))

from extract_poucher_tiers import match_name_to_cas


def test_poucher_matcher_avoids_prefix_identity_collisions():
    assert match_name_to_cas("Rosemary, French") == "8000-25-7"
    assert match_name_to_cas("Neroli, Italian") == "8016-38-0"
    assert match_name_to_cas("Pepper") is None
    assert match_name_to_cas("Ginger") is None


def test_poucher_matcher_resolves_specific_ester_names():
    assert match_name_to_cas("Linalyl salicylate") == "7149-28-2"
    assert match_name_to_cas("Methyl octine carbonate") == "111-80-8"
    assert match_name_to_cas("Methyl heptine carbonate") == "111-12-6"
    assert match_name_to_cas("Santalyl phenylacetate") == "1323-75-7"


def test_poucher_matcher_keeps_cassie_separate_from_orris():
    assert match_name_to_cas("Cassie absolute, Farnesiana") == "8015-61-0"
    assert match_name_to_cas("Orris concrete") == "8023-85-4"