diff --git a/changelog.d/2652.fixed.md b/changelog.d/2652.fixed.md new file mode 100644 index 0000000000..2508d12f61 --- /dev/null +++ b/changelog.d/2652.fixed.md @@ -0,0 +1 @@ +Fixed a Pension Credit property test that compared Guarantee Credit pound for pound where it started from zero. diff --git a/policyengine_uk/tests/test_pension_credit_widowed_parents_allowance_properties.py b/policyengine_uk/tests/test_pension_credit_widowed_parents_allowance_properties.py index 6c481ddf8f..a78336a9c3 100644 --- a/policyengine_uk/tests/test_pension_credit_widowed_parents_allowance_properties.py +++ b/policyengine_uk/tests/test_pension_credit_widowed_parents_allowance_properties.py @@ -25,7 +25,8 @@ 1. Extra Pension Credit income is the extra WPA above £10 a week, less the extra income tax and National Insurance, less any Carer's Allowance or Carer Support Payment it displaces. While Guarantee Credit is positive it - falls pound for pound with that income, and it never rises where no + falls pound for pound with that income until it reaches zero; from zero it + rises by no more than the income falls; and it never rises where no carer's benefit is displaced. 2. Differential: where neither Guarantee Credit nor Savings Credit is due and Housing Benefit income is above its zero floor, Housing Benefit applicable @@ -75,6 +76,12 @@ def carer(country): # Carer's Allowance in England and Carer Support Payment in Scotland, each # paid in full until WPA displaces it. CARERS = [carer("ENGLAND"), carer("SCOTLAND")] +# The same carer with £10,500 of IIDB: a draw where Guarantee Credit can start +# from zero once WPA displaces Carer's Allowance. +CARER_WITH_IIDB = dict( + carer("ENGLAND"), + benefits={**carer("ENGLAND")["benefits"], "iidb": (0, 10_500.0)}, +) def test_an_award_that_displaces_a_carer_benefit_raises_guarantee_credit_by_the_disregard(): @@ -108,6 +115,7 @@ def test_an_award_that_displaces_a_carer_benefit_raises_guarantee_credit_by_the_ @PROPERTY_SETTINGS @given(st.lists(family(state_pension=8_000), min_size=1, max_size=4)) @example(CARERS) +@example([CARER_WITH_IIDB]) def test_guarantee_credit_falls_pound_for_pound_with_widowed_parents_allowance( families, ): @@ -117,6 +125,7 @@ def test_guarantee_credit_falls_pound_for_pound_with_widowed_parents_allowance( (len(families), len(AMOUNTS)), [ "guarantee_credit", + "minimum_guarantee", "pension_credit_income", INCOME_TAX, "national_insurance", @@ -139,8 +148,22 @@ def test_guarantee_credit_falls_pound_for_pound_with_widowed_parents_allowance( assert np.allclose( extra_income[positive_income], expected[positive_income], atol=0.01 ), (families, pc_income, tax, carer_benefit) - paid = gc[..., 1:] > 0 - assert np.allclose(-np.diff(gc, axis=-1)[paid], extra_income[paid], atol=0.01), ( + # Guarantee Credit is the minimum guarantee less Pension Credit income, + # floored at zero, and WPA does not change the minimum guarantee (the + # carer addition follows entitlement before overlap). So Guarantee Credit + # falls pound for pound with the income until it reaches zero, and from + # zero it rises by no more than the income falls (round 2 review N4 of + # #2645). + assert np.allclose(np.diff(g["minimum_guarantee"], axis=-1), 0, atol=0.01), ( + families, + g["minimum_guarantee"], + ) + before, after = gc[..., :-1], gc[..., 1:] + paid = before > 0 + assert np.allclose( + after[paid], np.maximum(before - extra_income, 0)[paid], atol=0.01 + ), (families, gc, pc_income) + assert np.all(after[~paid] <= np.maximum(-extra_income, 0)[~paid] + 0.01), ( families, gc, pc_income,