Fix Costco hash-size weight parsing
This commit is contained in:
@@ -346,6 +346,32 @@ class CostcoPipelineTests(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual("LIFE 6'TABLE MDL", logistics["item_name_norm"])
|
||||
|
||||
def test_costco_hash_weight_parses_into_weight_basis(self):
|
||||
row = enrich_costco.parse_costco_item(
|
||||
order_id="abc",
|
||||
order_date="2024-11-29",
|
||||
raw_path=Path("costco_output/raw/abc.json"),
|
||||
line_no=4,
|
||||
item={
|
||||
"itemNumber": "999",
|
||||
"itemDescription01": "25# FLOUR ALL-PURPOSE HARV P98/100",
|
||||
"itemDescription02": None,
|
||||
"itemDepartmentNumber": 14,
|
||||
"transDepartmentNumber": 14,
|
||||
"unit": 1,
|
||||
"itemIdentifier": "E",
|
||||
"amount": 8.79,
|
||||
"itemUnitPriceAmount": 8.79,
|
||||
},
|
||||
)
|
||||
self.assertEqual("FLOUR ALL-PURPOSE HARV", row["item_name_norm"])
|
||||
self.assertEqual("25", row["size_value"])
|
||||
self.assertEqual("lb", row["size_unit"])
|
||||
self.assertEqual("weight", row["measure_type"])
|
||||
self.assertEqual("25", row["normalized_quantity"])
|
||||
self.assertEqual("lb", row["normalized_quantity_unit"])
|
||||
self.assertEqual("0.3516", row["price_per_lb"])
|
||||
|
||||
def test_build_items_enriched_matches_discount_to_item(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
raw_dir = Path(tmpdir) / "raw"
|
||||
|
||||
Reference in New Issue
Block a user