Non-consumable products updation

This commit is contained in:
sriram
2026-09-25 11:48:52 +05:30
parent fe208f4715
commit 6628207810
3 changed files with 84 additions and 4 deletions

View File

@@ -235,7 +235,38 @@ def test_a_toothpaste_brand_is_not_a_chocolate():
have been handed a health score.
"""
verdict = classify_edibility("General", "Colgate-Palmolive Palmolive Naturals")
assert verdict.edibility is not Edibility.CONSUMABLE
assert verdict.edibility is Edibility.NON_CONSUMABLE
@pytest.mark.parametrize("title", [
"Colgate-Palmolive Palmolive Naturals 350g",
"Colgate-Palmolive Palmolive Naturals 250g",
"Colgate-Palmolive Palmolive Naturals 100g",
# "honey" is a food word; the brand line has to outrank it
"Palmolive Naturals Milk & Honey 125g",
])
def test_a_non_food_line_in_general_is_not_scored(title):
"""Live rows in "General" whose titles name no article at all. Asserting
merely "not CONSUMABLE" let them through as UNKNOWN, and the write paths
score UNKNOWN - so the verdict has to be positively NON_CONSUMABLE."""
verdict = classify_edibility("General", title)
assert verdict.edibility is Edibility.NON_CONSUMABLE
assert verdict.signal == "title_brand_line"
@pytest.mark.parametrize("title", [
"Amul Butter 500g",
"Aachi Sambar Powder 100g",
"Dabur Honey 500g",
"Nestle Cerelac 300g",
])
def test_food_in_general_is_still_consumable(title):
assert is_consumable("General", title) is True
def test_a_real_category_outranks_the_brand_line():
"""The brand-line list is only consulted when the category says nothing."""
assert is_consumable("Dairy", "Pears Milk 500ml") is True
def test_soapnut_is_not_a_soap():