diff --git a/tests/domain/modelling/test_products.py b/tests/domain/modelling/test_products.py index e99daedc..1a97fb05 100644 --- a/tests/domain/modelling/test_products.py +++ b/tests/domain/modelling/test_products.py @@ -141,3 +141,30 @@ def test_heat_pump_rounds_design_heat_loss_up_to_the_next_band() -> None: assert abs(_pump_price(products, 15.0) - 10680.0) <= 1e-9 assert abs(_pump_price(products, 15.01) - 11400.0) <= 1e-9 # above largest assert abs(_pump_price(products, 25.0) - 11400.0) <= 1e-9 + + +def _full_distribution(products: Products, radiator_count: int) -> float: + """Isolate the full distribution line: no-system (decommission 0) + pump + (4 kW) 9720 + cylinder 2382.60 = 12102.60 base.""" + inputs = AshpCostInputs( + existing_system=AshpExistingSystem.NONE, + is_small_property=True, + design_heat_loss_kw=4.0, + radiator_count=radiator_count, + has_reusable_wet_system=False, + ) + return products.ashp_bundle_cost(inputs).total - 12102.60 + + +def test_radiator_count_is_clamped_to_the_distribution_table_bounds() -> None: + # Arrange — the distribution table only spans 4-12 radiators, so a proxy + # count outside that range is clamped to the nearest band (ADR-0025). + products = Products() + + # Act / Assert — below 4 prices as 4 (2220); above 12 prices as 12 (6288); + # in-range is exact. + assert abs(_full_distribution(products, 2) - 2220.0) <= 1e-9 + assert abs(_full_distribution(products, 4) - 2220.0) <= 1e-9 + assert abs(_full_distribution(products, 9) - 4680.0) <= 1e-9 + assert abs(_full_distribution(products, 12) - 6288.0) <= 1e-9 + assert abs(_full_distribution(products, 15) - 6288.0) <= 1e-9