Fix normalized quantity basis
This commit is contained in:
@@ -47,6 +47,8 @@ class PurchaseLogTests(unittest.TestCase):
|
||||
"upc": "4011",
|
||||
"qty": "1",
|
||||
"unit": "LB",
|
||||
"normalized_quantity": "1",
|
||||
"normalized_quantity_unit": "lb",
|
||||
"line_total": "1.29",
|
||||
"unit_price": "1.29",
|
||||
"measure_type": "weight",
|
||||
@@ -71,6 +73,8 @@ class PurchaseLogTests(unittest.TestCase):
|
||||
"retailer_item_id": "30669",
|
||||
"qty": "1",
|
||||
"unit": "E",
|
||||
"normalized_quantity": "3",
|
||||
"normalized_quantity_unit": "lb",
|
||||
"line_total": "2.98",
|
||||
"unit_price": "2.98",
|
||||
"size_value": "3",
|
||||
@@ -155,6 +159,8 @@ class PurchaseLogTests(unittest.TestCase):
|
||||
self.assertTrue(all(row["catalog_id"] == "cat_banana" for row in rows))
|
||||
self.assertEqual({"giant", "costco"}, {row["retailer"] for row in rows})
|
||||
self.assertEqual("https://example.test/banana.jpg", rows[0]["image_url"])
|
||||
self.assertEqual("1", rows[0]["normalized_quantity"])
|
||||
self.assertEqual("lb", rows[0]["normalized_quantity_unit"])
|
||||
|
||||
def test_main_writes_purchase_and_example_csvs(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
@@ -184,6 +190,8 @@ class PurchaseLogTests(unittest.TestCase):
|
||||
"upc": "4011",
|
||||
"qty": "1",
|
||||
"unit": "LB",
|
||||
"normalized_quantity": "1",
|
||||
"normalized_quantity_unit": "lb",
|
||||
"line_total": "1.29",
|
||||
"unit_price": "1.29",
|
||||
"measure_type": "weight",
|
||||
@@ -208,6 +216,8 @@ class PurchaseLogTests(unittest.TestCase):
|
||||
"retailer_item_id": "30669",
|
||||
"qty": "1",
|
||||
"unit": "E",
|
||||
"normalized_quantity": "3",
|
||||
"normalized_quantity_unit": "lb",
|
||||
"line_total": "2.98",
|
||||
"unit_price": "2.98",
|
||||
"size_value": "3",
|
||||
@@ -346,6 +356,8 @@ class PurchaseLogTests(unittest.TestCase):
|
||||
"upc": "",
|
||||
"qty": "1",
|
||||
"unit": "EA",
|
||||
"normalized_quantity": "1",
|
||||
"normalized_quantity_unit": "each",
|
||||
"line_total": "3.50",
|
||||
"unit_price": "3.50",
|
||||
"measure_type": "each",
|
||||
@@ -403,6 +415,8 @@ class PurchaseLogTests(unittest.TestCase):
|
||||
self.assertEqual("approved", rows[0]["review_status"])
|
||||
self.assertEqual("create", rows[0]["resolution_action"])
|
||||
self.assertEqual("cat_ice", links[0]["catalog_id"])
|
||||
self.assertEqual("1", rows[0]["normalized_quantity"])
|
||||
self.assertEqual("each", rows[0]["normalized_quantity_unit"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user