Finalize post-refactor layout and remove old pipeline files
This commit is contained in:
@@ -7,7 +7,6 @@ from unittest import mock
|
||||
|
||||
import enrich_costco
|
||||
import scrape_costco
|
||||
import validate_cross_retailer_flow
|
||||
|
||||
|
||||
class CostcoPipelineTests(unittest.TestCase):
|
||||
@@ -423,76 +422,6 @@ class CostcoPipelineTests(unittest.TestCase):
|
||||
self.assertIn("matched_discount=4873222", purchase_row["parse_notes"])
|
||||
self.assertIn("matched_to_item=4873222", discount_row["parse_notes"])
|
||||
|
||||
def test_cross_retailer_validation_writes_proof_example(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
giant_csv = Path(tmpdir) / "giant_items_enriched.csv"
|
||||
costco_csv = Path(tmpdir) / "costco_items_enriched.csv"
|
||||
outdir = Path(tmpdir) / "combined"
|
||||
|
||||
fieldnames = enrich_costco.OUTPUT_FIELDS
|
||||
giant_row = {field: "" for field in fieldnames}
|
||||
giant_row.update(
|
||||
{
|
||||
"retailer": "giant",
|
||||
"order_id": "g1",
|
||||
"line_no": "1",
|
||||
"order_date": "2026-03-01",
|
||||
"retailer_item_id": "100",
|
||||
"item_name": "FRESH BANANA",
|
||||
"item_name_norm": "BANANA",
|
||||
"upc": "4011",
|
||||
"measure_type": "weight",
|
||||
"is_store_brand": "false",
|
||||
"is_fee": "false",
|
||||
"is_discount_line": "false",
|
||||
"is_coupon_line": "false",
|
||||
"line_total": "1.29",
|
||||
}
|
||||
)
|
||||
costco_row = {field: "" for field in fieldnames}
|
||||
costco_row.update(
|
||||
{
|
||||
"retailer": "costco",
|
||||
"order_id": "c1",
|
||||
"line_no": "1",
|
||||
"order_date": "2026-03-12",
|
||||
"retailer_item_id": "30669",
|
||||
"item_name": "BANANAS 3 LB / 1.36 KG",
|
||||
"item_name_norm": "BANANA",
|
||||
"upc": "",
|
||||
"size_value": "3",
|
||||
"size_unit": "lb",
|
||||
"measure_type": "weight",
|
||||
"is_store_brand": "false",
|
||||
"is_fee": "false",
|
||||
"is_discount_line": "false",
|
||||
"is_coupon_line": "false",
|
||||
"line_total": "2.98",
|
||||
}
|
||||
)
|
||||
|
||||
with giant_csv.open("w", newline="", encoding="utf-8") as handle:
|
||||
writer = csv.DictWriter(handle, fieldnames=fieldnames)
|
||||
writer.writeheader()
|
||||
writer.writerow(giant_row)
|
||||
with costco_csv.open("w", newline="", encoding="utf-8") as handle:
|
||||
writer = csv.DictWriter(handle, fieldnames=fieldnames)
|
||||
writer.writeheader()
|
||||
writer.writerow(costco_row)
|
||||
|
||||
validate_cross_retailer_flow.main.callback(
|
||||
giant_items_enriched_csv=str(giant_csv),
|
||||
costco_items_enriched_csv=str(costco_csv),
|
||||
outdir=str(outdir),
|
||||
)
|
||||
|
||||
proof_path = outdir / "proof_examples.csv"
|
||||
self.assertTrue(proof_path.exists())
|
||||
with proof_path.open(newline="", encoding="utf-8") as handle:
|
||||
rows = list(csv.DictReader(handle))
|
||||
self.assertEqual(1, len(rows))
|
||||
self.assertEqual("banana", rows[0]["proof_name"])
|
||||
|
||||
def test_main_writes_summary_request_metadata(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
outdir = Path(tmpdir) / "costco_output"
|
||||
|
||||
Reference in New Issue
Block a user