Spaces:
Sleeping
Sleeping
test: cover supplementary ambiguous dates
Browse files- tests/test_audit.py +8 -1
tests/test_audit.py
CHANGED
|
@@ -104,7 +104,8 @@ def test_sugar_free_packet_surfaces_sweetener_and_requests_nutrition_panel():
|
|
| 104 |
assert any("sugar free" in finding.headline.lower() for finding in result.persuasion_gap)
|
| 105 |
assert result.ingredients[-1] == "Vitamins and Mineral Mix"
|
| 106 |
assert result.expiry.visible_date_texts == ["FEB 2024", "JUL 2025"]
|
| 107 |
-
assert
|
|
|
|
| 108 |
sugar_step = next(step for step in result.investigation.steps if "Sugar Free" in step.reason)
|
| 109 |
assert sugar_step.tool == "inspect_nutrition"
|
| 110 |
|
|
@@ -165,6 +166,12 @@ def test_enrichment_claim_cites_visible_back_label_evidence():
|
|
| 165 |
assert any("Calcium" in evidence.text for evidence in claim.evidence)
|
| 166 |
|
| 167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
def test_one_character_ocr_claim_mismatch_is_surfaced_conservatively():
|
| 169 |
result = audit_packet("Real Badar", "Ingredients: ** Maltodextrin (65%), Badam, Sucralose.")
|
| 170 |
claim = by_claim(result, "Real Badar")
|
|
|
|
| 104 |
assert any("sugar free" in finding.headline.lower() for finding in result.persuasion_gap)
|
| 105 |
assert result.ingredients[-1] == "Vitamins and Mineral Mix"
|
| 106 |
assert result.expiry.visible_date_texts == ["FEB 2024", "JUL 2025"]
|
| 107 |
+
assert "visible date evidence" in result.expiry.status.lower()
|
| 108 |
+
assert not any("visible dates" in item.lower() for item in result.investigation.missing_evidence)
|
| 109 |
sugar_step = next(step for step in result.investigation.steps if "Sugar Free" in step.reason)
|
| 110 |
assert sugar_step.tool == "inspect_nutrition"
|
| 111 |
|
|
|
|
| 166 |
assert any("Calcium" in evidence.text for evidence in claim.evidence)
|
| 167 |
|
| 168 |
|
| 169 |
+
def test_ambiguous_dates_are_supplementary_when_not_a_front_claim():
|
| 170 |
+
result = audit_packet("SUGAR FREE", "Nutrition per 100g: Total Sugars 0g. Net Weight 200g. FEB 2024 JUL 2025.")
|
| 171 |
+
assert result.expiry.visible_date_texts == ["FEB 2024", "JUL 2025"]
|
| 172 |
+
assert not any("date" in item.lower() for item in result.investigation.missing_evidence)
|
| 173 |
+
|
| 174 |
+
|
| 175 |
def test_one_character_ocr_claim_mismatch_is_surfaced_conservatively():
|
| 176 |
result = audit_packet("Real Badar", "Ingredients: ** Maltodextrin (65%), Badam, Sucralose.")
|
| 177 |
claim = by_claim(result, "Real Badar")
|