Skip to content

Commit ed4f10b

Browse files
vahid-ahmadiclaude
andauthored
Pay couple Carer Premium when a benunit has 3+ carers (#1623)
* Pay couple Carer Premium when a benunit has 3+ carers The select list used carers == 2, so any benefit unit with 3 or more carers silently fell through to the numpy default of 0. A benefit unit with e.g. two adult carers plus a young-carer child meeting is_carer_for_benefits is the realistic way this arises. The Carer Premium regulations don't define a rate for >2 carers, so clamping to the couple rate is the correct behaviour. Rewrote the select as [carers >= 2, carers == 1] → [couple, single], which also drops the now-redundant carers == 0 branch (select's default is 0 already). Fixes #420. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Add regression test for #420 (three-carer benefit unit) Covers the carers >= 2 branch of carer_premium with an explicit num_carers=3 case that would have returned 0 under the previous select. Also adds num_carers=0 and num_carers=2 cases so the full branch table is exercised. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f59b5c1 commit ed4f10b

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

changelog.d/420.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Pay the two-carer Carer Premium rate when a benefit unit has three or more carers. The previous `carers == 2` condition silently returned £0 for the (rare) case of three or more carers in the same benefit unit; the Carer Premium regulations don't define a higher rate, so the couple rate is the correct ceiling.

policyengine_uk/tests/policy/baseline/finance/benefit/care.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,27 @@
77
is_carer_for_benefits: true
88
num_carers: 1
99
carer_premium: 37.5 * 52
10+
11+
- name: Two carers in a benefit unit receive the couple rate
12+
period: 2020
13+
absolute_error_margin: 0
14+
input:
15+
num_carers: 2
16+
output:
17+
carer_premium: 37.5 * 52
18+
19+
- name: Three carers in a benefit unit stay at the couple rate (regression for #420)
20+
period: 2020
21+
absolute_error_margin: 0
22+
input:
23+
num_carers: 3
24+
output:
25+
carer_premium: 37.5 * 52
26+
27+
- name: No carers in a benefit unit receive no premium
28+
period: 2020
29+
absolute_error_margin: 0
30+
input:
31+
num_carers: 0
32+
output:
33+
carer_premium: 0

policyengine_uk/variables/household/demographic/carer_premium.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def formula(benunit, period, parameters):
1313
carers = benunit("num_carers", period.this_year)
1414
CP = parameters(period).gov.dwp.carer_premium
1515
weekly_premium = select(
16-
[carers == 0, carers == 1, carers == 2],
17-
[0, CP.single, CP.couple],
16+
[carers >= 2, carers == 1],
17+
[CP.couple, CP.single],
1818
)
1919
return weekly_premium * WEEKS_IN_YEAR

0 commit comments

Comments
 (0)