SLICE-6: export & the round-trip lock — canonical serializer + streamed export (SD-0002 §7.2) #29
@@ -170,3 +170,27 @@ def test_inv12_roundtrip_is_noop_over_generated_catalogs():
|
|||||||
assert result.summary["updates"] == 0, f"seed {seed}: {result.summary}"
|
assert result.summary["updates"] == 0, f"seed {seed}: {result.summary}"
|
||||||
assert result.summary["errors"] == 0, f"seed {seed}: {result.summary}"
|
assert result.summary["errors"] == 0, f"seed {seed}: {result.summary}"
|
||||||
assert result.summary["unchanged"] == len(catalog), f"seed {seed}"
|
assert result.summary["unchanged"] == len(catalog), f"seed {seed}"
|
||||||
|
|
||||||
|
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
|
def test_decimal_and_int_variant_fields_roundtrip():
|
||||||
|
catalog = {
|
||||||
|
"priced": CatalogProduct(
|
||||||
|
id=1, handle="priced", title="Priced",
|
||||||
|
option_names=(None, None, None),
|
||||||
|
fields={"title": "Priced", "description_html": None, "vendor": None,
|
||||||
|
"product_type": "standalone", "google_product_category": None,
|
||||||
|
"tags": [], "status": "active", "published": True},
|
||||||
|
variants=[CatalogVariant(
|
||||||
|
id=1, options=(None, None, None), position=1,
|
||||||
|
fields={"sku": "P1", "price": Decimal("18.00"),
|
||||||
|
"cost": Decimal("9.5"), "weight": Decimal("0.250"),
|
||||||
|
"inventory_qty": 40, "variant_image": None})],
|
||||||
|
images=[],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
result = _roundtrip_diff(catalog)
|
||||||
|
assert result.summary["unchanged"] == 1, result.records
|
||||||
|
assert result.summary["updates"] == 0
|
||||||
|
|||||||
Reference in New Issue
Block a user