fix country code

This commit is contained in:
Раис Юсупалиев
2026-03-09 15:24:10 +03:00
parent 2d68aff34d
commit da301d4bc4
8 changed files with 155 additions and 45 deletions
+5
View File
@@ -28,6 +28,7 @@ def _make_request(**overrides) -> DeliveryRequest:
"entity": DeliveryEntity.INDIVIDUAL,
"from_city": " Moscow ",
"to_city": " Saint Petersburg ",
"country_code": " ru ",
"weight_kg": 1.235,
"length_cm": 10.04,
"width_cm": 20.05,
@@ -45,15 +46,18 @@ def test_normalize_delivery_request_applies_rules_without_side_effects() -> None
assert normalized is not request
assert normalized.from_city == "Moscow"
assert normalized.to_city == "Saint Petersburg"
assert normalized.country_code == "RU"
assert normalized.weight_kg == Decimal("1.24")
assert normalized.length_cm == Decimal("10.0")
assert normalized.width_cm == Decimal("20.1")
assert normalized.height_cm == Decimal("30.1")
assert request.from_city == " Moscow "
assert request.country_code == " ru "
def test_normalize_delivery_request_handles_normalization_boundaries() -> None:
request = _make_request(
country_code=" ",
weight_kg=0.0001,
length_cm=0.01,
width_cm=0.04,
@@ -68,6 +72,7 @@ def test_normalize_delivery_request_handles_normalization_boundaries() -> None:
assert low_scale.width_cm == Decimal("0.1")
assert low_scale.height_cm == Decimal("0.2")
assert high_scale.weight_kg == Decimal("0.01")
assert low_scale.country_code is None
def test_filter_valid_prices_handles_empty_input() -> None: