Skip to content

Commit 46afb00

Browse files
authored
Add three EntitledTo-style integration tests (#778) (#1713)
#778 asks for ~20 worked benefit scenarios checked against EntitledTo. This is a first batch of three covering the most common household shapes the calculator handles: 1. single 30-year-old working part-time on low pay, private renter in London (UC + child benefit zero, no income tax/NI), 2. couple with two children, one earner at £22k, social housing in North West (UC + child benefit, partial NI/income tax), 3. pensioner couple with low state pension, sits below Pension Credit guarantee level (PC payout + winter fuel allowance). Values are pinned to the current PolicyEngine output and the file is labelled as a regression-grade baseline rather than an authoritative EntitledTo cross-validation — future work is to manually re-run the matching cases through EntitledTo and tighten any rows where the two disagree, ratcheting up to the ~20-scenario coverage in the issue. Person-level variables (income_tax, national_insurance) can't be asserted with a single scalar when multiple people are in the benunit, so scenario 2 uses household_tax instead.
1 parent bc28bab commit 46afb00

2 files changed

Lines changed: 100 additions & 0 deletions

File tree

changelog.d/778.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add three worked benefit scenarios at `policyengine_uk/tests/policy/integration/entitledto_scenarios.yaml` as a first batch of EntitledTo-style regression tests (single low-earner private renter, couple with two children in social housing, pensioner couple on the Pension Credit guarantee), seeding the ~20-scenario coverage suggested in #778.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Worked benefit scenarios for cross-checking against EntitledTo
2+
# (https://www.entitledto.co.uk/), tracked in issue #778.
3+
#
4+
# These are pinned to PolicyEngine's current outputs and serve as
5+
# regression tests rather than authoritative EntitledTo matches: the
6+
# numbers were generated by running each scenario through PolicyEngine
7+
# at the time the file was added. Future work is to manually run the
8+
# matching cases through EntitledTo and tighten any rows where the two
9+
# disagree, ratcheting up to the ~20-scenario coverage suggested in #778.
10+
11+
- name: "EntitledTo #1 - single 30yo working part-time at low pay, private renter in London"
12+
period: 2025
13+
absolute_error_margin: 1
14+
input:
15+
people:
16+
adult:
17+
age: 30
18+
employment_income: 12_000
19+
benunits:
20+
benunit:
21+
members: [adult]
22+
households:
23+
household:
24+
members: [adult]
25+
rent: 8_000
26+
council_tax: 1_200
27+
region: LONDON
28+
country: ENGLAND
29+
tenure_type: RENT_PRIVATELY
30+
output:
31+
income_tax: 0
32+
national_insurance: 0
33+
universal_credit: 3_662.72
34+
housing_benefit: 0
35+
child_benefit: 0
36+
household_net_income: 14_303.68
37+
38+
- name: "EntitledTo #2 - couple with 2 children, one earner at £22k, social housing in North West"
39+
period: 2025
40+
absolute_error_margin: 1
41+
input:
42+
people:
43+
adult_1:
44+
age: 35
45+
employment_income: 22_000
46+
adult_2:
47+
age: 35
48+
child_1:
49+
age: 5
50+
child_2:
51+
age: 3
52+
benunits:
53+
benunit:
54+
members: [adult_1, adult_2, child_1, child_2]
55+
households:
56+
household:
57+
members: [adult_1, adult_2, child_1, child_2]
58+
rent: 6_000
59+
council_tax: 1_500
60+
region: NORTH_WEST
61+
country: ENGLAND
62+
tenure_type: RENT_FROM_COUNCIL
63+
output:
64+
# Household-level aggregates only — per-person income_tax / NI can't be
65+
# asserted with a single scalar when multiple people are in the benunit.
66+
household_tax: 4_047.45
67+
universal_credit: 12_490.86
68+
housing_benefit: 0
69+
child_benefit: 2_251.60
70+
household_net_income: 36_130.40
71+
72+
- name: "EntitledTo #3 - pensioner couple, low state pension, qualifies for Pension Credit"
73+
period: 2025
74+
absolute_error_margin: 1
75+
input:
76+
people:
77+
pensioner_1:
78+
age: 70
79+
state_pension: 8_000
80+
pensioner_2:
81+
age: 68
82+
state_pension: 6_000
83+
benunits:
84+
benunit:
85+
members: [pensioner_1, pensioner_2]
86+
households:
87+
household:
88+
members: [pensioner_1, pensioner_2]
89+
region: WEST_MIDLANDS
90+
country: ENGLAND
91+
council_tax: 1_800
92+
output:
93+
universal_credit: 0
94+
housing_benefit: 0
95+
pension_credit: 3_607.72
96+
winter_fuel_allowance: 200
97+
income_tax: 0
98+
national_insurance: 0
99+
household_net_income: 15_848.68

0 commit comments

Comments
 (0)