|
| 1 | +import pytest |
| 2 | + |
| 3 | +from policyengine_uk import Simulation |
| 4 | +from policyengine_uk.variables.gov.gov_tax import gov_tax |
| 5 | +from policyengine_uk.variables.gov.hmrc.household_tax import household_tax |
| 6 | + |
| 7 | + |
| 8 | +def _homeowner(main_residence_value: float, region: str = "LONDON") -> dict: |
| 9 | + return { |
| 10 | + "people": { |
| 11 | + "person": { |
| 12 | + "age": {2026: 45, 2028: 47, 2029: 48}, |
| 13 | + "employment_income": {2028: 0, 2029: 0}, |
| 14 | + } |
| 15 | + }, |
| 16 | + "benunits": {"benunit": {"members": ["person"]}}, |
| 17 | + "households": { |
| 18 | + "household": { |
| 19 | + "members": ["person"], |
| 20 | + "region": {2028: region, 2029: region}, |
| 21 | + "main_residence_value": {2026: main_residence_value}, |
| 22 | + } |
| 23 | + }, |
| 24 | + } |
| 25 | + |
| 26 | + |
| 27 | +def test_high_value_council_tax_surcharge_starts_in_2028(): |
| 28 | + sim = Simulation(situation=_homeowner(2_400_000)) |
| 29 | + |
| 30 | + assert sim.calculate("high_value_council_tax_surcharge", 2027)[0] == 0 |
| 31 | + assert sim.calculate("high_value_council_tax_surcharge", 2028)[0] == 2_500 |
| 32 | + |
| 33 | + |
| 34 | +def test_high_value_council_tax_surcharge_is_uprated_from_2029(): |
| 35 | + sim = Simulation(situation=_homeowner(2_400_000)) |
| 36 | + current = sim.tax_benefit_system.parameters("2029") |
| 37 | + previous = sim.tax_benefit_system.parameters("2028") |
| 38 | + expected_2029 = ( |
| 39 | + 2_500 |
| 40 | + * float(current.gov.benefit_uprating_cpi) |
| 41 | + / float(previous.gov.benefit_uprating_cpi) |
| 42 | + ) |
| 43 | + |
| 44 | + assert sim.calculate("high_value_council_tax_surcharge", 2029)[0] == pytest.approx( |
| 45 | + expected_2029 |
| 46 | + ) |
| 47 | + |
| 48 | + |
| 49 | +def test_high_value_council_tax_surcharge_flows_into_tax_aggregates(): |
| 50 | + sim = Simulation(situation=_homeowner(2_400_000)) |
| 51 | + |
| 52 | + other_household_taxes = sum( |
| 53 | + sim.calculate(variable, 2028)[0] |
| 54 | + for variable in household_tax.adds |
| 55 | + if variable != "high_value_council_tax_surcharge" |
| 56 | + ) |
| 57 | + other_government_taxes = sum( |
| 58 | + sim.calculate(variable, 2028)[0] |
| 59 | + for variable in gov_tax.adds |
| 60 | + if variable != "high_value_council_tax_surcharge" |
| 61 | + ) |
| 62 | + |
| 63 | + assert sim.calculate("household_tax", 2028)[0] - other_household_taxes == 2_500 |
| 64 | + assert sim.calculate("gov_tax", 2028)[0] - other_government_taxes == 2_500 |
| 65 | + |
| 66 | + |
| 67 | +def test_high_value_council_tax_surcharge_only_applies_in_england(): |
| 68 | + sim = Simulation(situation=_homeowner(6_000_000, region="SCOTLAND")) |
| 69 | + |
| 70 | + assert sim.calculate("high_value_council_tax_surcharge", 2028)[0] == 0 |
0 commit comments