From 816caad02e00ef6744ed9d5543363a397f3bf877 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 7 Apr 2026 12:31:14 -0400 Subject: [PATCH] Replace high-value surcharge test with YAML policy tests --- .../high_value_council_tax_surcharge.yaml | 51 ++++++++++++++ .../test_high_value_council_tax_surcharge.py | 70 ------------------- 2 files changed, 51 insertions(+), 70 deletions(-) create mode 100644 policyengine_uk/tests/policy/baseline/gov/hmrc/council_tax/high_value_council_tax_surcharge.yaml delete mode 100644 policyengine_uk/tests/test_high_value_council_tax_surcharge.py diff --git a/policyengine_uk/tests/policy/baseline/gov/hmrc/council_tax/high_value_council_tax_surcharge.yaml b/policyengine_uk/tests/policy/baseline/gov/hmrc/council_tax/high_value_council_tax_surcharge.yaml new file mode 100644 index 000000000..94b896ccb --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/gov/hmrc/council_tax/high_value_council_tax_surcharge.yaml @@ -0,0 +1,51 @@ +- name: High value council tax surcharge starts in 2028 + period: 2027 + input: + region: LONDON + main_residence_value: 3_000_000 + main_residential_property_purchased: 0 + council_tax: 0 + household_owns_tv: false + gov.hmrc.stamp_duty.property_sale_rate: 0 + output: + high_value_council_tax_surcharge: 0 +- name: High value council tax surcharge applies in England and flows into aggregates + period: 2028 + input: + region: LONDON + main_residence_value: 2_554_326.811538164 + main_residential_property_purchased: 0 + council_tax: 0 + household_owns_tv: false + gov.hmrc.stamp_duty.property_sale_rate: 0 + output: + high_value_council_tax_surcharge: 2_500 + household_tax: 2_500 + gov_tax: 2_500 +- name: High value council tax surcharge is uprated from 2029 + period: 2029 + absolute_error_margin: 0.01 + input: + region: LONDON + main_residence_value: 2_629_940.453174542 + main_residential_property_purchased: 0 + council_tax: 0 + household_owns_tv: false + gov.hmrc.stamp_duty.property_sale_rate: 0 + output: + high_value_council_tax_surcharge: 2_550 + household_tax: 2_550 + gov_tax: 2_550 +- name: High value council tax surcharge only applies in England + period: 2028 + input: + region: SCOTLAND + main_residence_value: 7_000_000 + main_residential_property_purchased: 0 + council_tax: 0 + household_owns_tv: false + gov.hmrc.stamp_duty.property_sale_rate: 0 + output: + high_value_council_tax_surcharge: 0 + household_tax: 0 + gov_tax: 0 diff --git a/policyengine_uk/tests/test_high_value_council_tax_surcharge.py b/policyengine_uk/tests/test_high_value_council_tax_surcharge.py deleted file mode 100644 index 706af054a..000000000 --- a/policyengine_uk/tests/test_high_value_council_tax_surcharge.py +++ /dev/null @@ -1,70 +0,0 @@ -import pytest - -from policyengine_uk import Simulation -from policyengine_uk.variables.gov.gov_tax import gov_tax -from policyengine_uk.variables.gov.hmrc.household_tax import household_tax - - -def _homeowner(main_residence_value: float, region: str = "LONDON") -> dict: - return { - "people": { - "person": { - "age": {2026: 45, 2028: 47, 2029: 48}, - "employment_income": {2028: 0, 2029: 0}, - } - }, - "benunits": {"benunit": {"members": ["person"]}}, - "households": { - "household": { - "members": ["person"], - "region": {2028: region, 2029: region}, - "main_residence_value": {2026: main_residence_value}, - } - }, - } - - -def test_high_value_council_tax_surcharge_starts_in_2028(): - sim = Simulation(situation=_homeowner(2_400_000)) - - assert sim.calculate("high_value_council_tax_surcharge", 2027)[0] == 0 - assert sim.calculate("high_value_council_tax_surcharge", 2028)[0] == 2_500 - - -def test_high_value_council_tax_surcharge_is_uprated_from_2029(): - sim = Simulation(situation=_homeowner(2_400_000)) - current = sim.tax_benefit_system.parameters("2029") - previous = sim.tax_benefit_system.parameters("2028") - expected_2029 = ( - 2_500 - * float(current.gov.benefit_uprating_cpi) - / float(previous.gov.benefit_uprating_cpi) - ) - - assert sim.calculate("high_value_council_tax_surcharge", 2029)[0] == pytest.approx( - expected_2029 - ) - - -def test_high_value_council_tax_surcharge_flows_into_tax_aggregates(): - sim = Simulation(situation=_homeowner(2_400_000)) - - other_household_taxes = sum( - sim.calculate(variable, 2028)[0] - for variable in household_tax.adds - if variable != "high_value_council_tax_surcharge" - ) - other_government_taxes = sum( - sim.calculate(variable, 2028)[0] - for variable in gov_tax.adds - if variable != "high_value_council_tax_surcharge" - ) - - assert sim.calculate("household_tax", 2028)[0] - other_household_taxes == 2_500 - assert sim.calculate("gov_tax", 2028)[0] - other_government_taxes == 2_500 - - -def test_high_value_council_tax_surcharge_only_applies_in_england(): - sim = Simulation(situation=_homeowner(6_000_000, region="SCOTLAND")) - - assert sim.calculate("high_value_council_tax_surcharge", 2028)[0] == 0