Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/2652.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a Pension Credit property test that compared Guarantee Credit pound for pound where it started from zero.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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,
):
Expand All @@ -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",
Expand All @@ -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,
Expand Down
Loading