Skip to content

Commit b26d4af

Browse files
committed
Format UC rebalancing follow-up changes
1 parent ce1d3f5 commit b26d4af

2 files changed

Lines changed: 13 additions & 21 deletions

File tree

policyengine_uk/scenarios/uc_reform.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ def _protected_single_young_health_element_monthly(
4949
) -> float:
5050
baseline = sim.tax_benefit_system.parameters(str(BASELINE_UC_REBALANCING_YEAR))
5151
protected_combined_award = _benefit_uprating_ratio(sim, year) * (
52-
float(
53-
baseline.gov.dwp.universal_credit.standard_allowance.amount.SINGLE_YOUNG
54-
)
52+
float(baseline.gov.dwp.universal_credit.standard_allowance.amount.SINGLE_YOUNG)
5553
+ float(baseline.gov.dwp.universal_credit.elements.disabled.amount)
5654
)
5755
return protected_combined_award - _rebalanced_standard_allowance_monthly(
@@ -85,9 +83,9 @@ def add_universal_credit_reform(sim: Microsimulation):
8583
_protected_existing_health_element_monthly(sim, year) * 12,
8684
dtype=current_health_element.dtype,
8785
)
88-
protected_health_element[
89-
claimant_type == UCClaimantType.SINGLE_YOUNG.name
90-
] = _protected_single_young_health_element_monthly(sim, year) * 12
86+
protected_health_element[claimant_type == UCClaimantType.SINGLE_YOUNG.name] = (
87+
_protected_single_young_health_element_monthly(sim, year) * 12
88+
)
9189
current_health_element[has_health_element & ~is_post_2025_claimant] = (
9290
protected_health_element[has_health_element & ~is_post_2025_claimant]
9391
)

policyengine_uk/tests/test_uc_rebalancing.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,18 @@ def _cpi_protected_uc_award_monthly(
7070

7171

7272
@pytest.mark.parametrize("age_2025", [20, 30])
73-
def test_existing_claimants_keep_combined_award_cpi_protected(
74-
monkeypatch, age_2025
75-
):
73+
def test_existing_claimants_keep_combined_award_cpi_protected(monkeypatch, age_2025):
7674
_force_uc_seed(monkeypatch, [0.99])
7775
sim = Simulation(situation=_uc_claimant(age_2025))
7876
claimant_type = "SINGLE_YOUNG" if age_2025 < 25 else "SINGLE_OLD"
7977

8078
for year in range(2026, 2030):
8179
standard_allowance = sim.calculate("uc_standard_allowance", year)[0] / 12
8280
health_element = sim.calculate("uc_LCWRA_element", year)[0] / 12
83-
new_claimant_health_element = (
84-
float(
85-
sim.tax_benefit_system.parameters(
86-
str(year)
87-
).gov.dwp.universal_credit.rebalancing.new_claimant_health_element
88-
)
81+
new_claimant_health_element = float(
82+
sim.tax_benefit_system.parameters(
83+
str(year)
84+
).gov.dwp.universal_credit.rebalancing.new_claimant_health_element
8985
)
9086

9187
assert health_element > new_claimant_health_element
@@ -100,12 +96,10 @@ def test_new_claimants_use_fixed_health_element(monkeypatch):
10096

10197
for year in range(2026, 2030):
10298
health_element = sim.calculate("uc_LCWRA_element", year)[0] / 12
103-
expected_health = (
104-
float(
105-
sim.tax_benefit_system.parameters(
106-
str(year)
107-
).gov.dwp.universal_credit.rebalancing.new_claimant_health_element
108-
)
99+
expected_health = float(
100+
sim.tax_benefit_system.parameters(
101+
str(year)
102+
).gov.dwp.universal_credit.rebalancing.new_claimant_health_element
109103
)
110104

111105
assert health_element == pytest.approx(expected_health)

0 commit comments

Comments
 (0)