abstracted out bounded cycles

This commit is contained in:
TPV committed 2026-07-30 14:13:26 -07:00
1 parent aa6ed4cb06
commit 8903be2685
3 files changed
+229 -3

No files matched your search

+19
View File
@@ -30,6 +30,9 @@ def _doc(**overrides) -> dict:
"endDate": None,
"priceBeforeDrop": None,
"eduPrice": None,
"pastPrices": [
{"price": 80.0, "date": datetime(2026, 7, 26, tzinfo=timezone.utc)}
],
"available": True,
"condition": None,
"appExclusive": None,
@@ -103,3 +106,19 @@ def test_dollar_code_does_not_affect_threshold():
promoMinSpend=100,
)
assert build_product_details(doc, min_percentage=40) is None
# ----------------------------------------------------------------- pastPrices
def test_past_prices_read_through():
"""Price history passes through unchanged."""
history = [
{"price": 95.0, "date": datetime(2026, 7, 20, tzinfo=timezone.utc)},
{"price": 90.0, "date": datetime(2026, 7, 24, tzinfo=timezone.utc)},
]
product = build_product_details(_doc(pastPrices=history), min_percentage=0)
assert product.pricing.past_prices == history