Download tests/test_patent_tuple_review.py from mattbitzesty/pino-source-code: direct link, hf CLI and curl.
- Browser
- Download file 2.4 kB
-
https://huggingface.co/mattbitzesty/pino-source-code/resolve/main/tests/test_patent_tuple_review.py
- Command line
-
hf download hf://mattbitzesty/pino-source-code/tests/test_patent_tuple_review.py
-
curl -L -o test_patent_tuple_review.py https://huggingface.co/mattbitzesty/pino-source-code/resolve/main/tests/test_patent_tuple_review.py
2.4 kB
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts")) | |
| from review_patent_substantivity_tuples import mock_review, normalize_decision, tuple_row # noqa: E402 | |
| def test_normalize_decision_accepts_only_supported_single_molecule_tuple(): | |
| row = { | |
| "patent_id": "US123A1", | |
| "source_locus": "description:10", | |
| "compound_ref_verbatim": "compound 7", | |
| "resolved_cas": "100-52-7", | |
| "resolved_smiles": None, | |
| "measured_value_verbatim": "24 hours", | |
| "units": "hours", | |
| "construct": { | |
| "property_name": "substantivity", | |
| "substrate": ["skin"], | |
| "time_points": ["24 hours"], | |
| }, | |
| "verbatim_quote": "Compound 7 (100-52-7) had substantivity on skin for 24 hours.", | |
| "provenance": {"url": "https://patents.google.com/patent/US123A1/en"}, | |
| } | |
| poucher = {"100-52-7": {"poucher_coefficient": 1, "tier_band": "top", "all_poucher_names": ["Benzaldehyde"]}} | |
| normalized = normalize_decision(row, mock_review(row), poucher, 0.75, "mock", "mock", 1) | |
| assert normalized["accepted_for_exploratory_tuple_set"] is True | |
| assert normalized["poucher_overlap"]["by_cas"] is True | |
| assert tuple_row(normalized)["measured_value"] == "24 hours" | |
| def test_normalize_decision_rejects_missing_construct_overlap(): | |
| row = { | |
| "patent_id": "US123A1", | |
| "source_locus": "description:11", | |
| "verbatim_quote": "Compound 7 is included at 10 to 30 wt% in a fragrance composition.", | |
| "provenance": {}, | |
| } | |
| decision = { | |
| "action": "accept", | |
| "single_molecule": True, | |
| "molecule_name": "compound 7", | |
| "cas": None, | |
| "smiles": None, | |
| "measured_property": "other", | |
| "measured_value": "10 to 30 wt%", | |
| "units": "wt%", | |
| "substrate": None, | |
| "timepoint": None, | |
| "method_summary": "Composition loading.", | |
| "construct_overlap_with_poucher": False, | |
| "construct_overlap_reason": "Composition percentage is not olfactive duration.", | |
| "evidence_quote": "10 to 30 wt%", | |
| "confidence": 0.95, | |
| } | |
| normalized = normalize_decision(row, decision, {}, 0.75, "mock", "mock", 1) | |
| assert normalized["accepted_for_exploratory_tuple_set"] is False | |
| assert "no_poucher_construct_overlap" in normalized["validation_errors"] | |