From 9ab75541d2ad16ea58b0ef6608a781fe9f8bd16a Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 2 Oct 2026 23:02:23 -0400 Subject: [PATCH] Give UC property-test adults explicit claimant roles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since #1896, UC counts income only for the claimant, partner and UC children, and presumes an adult under 20 who is 16 or more years younger than another to be their child. The capital-income property test's single-count expectation summed every member's listed income, so a family aged 19 and 57 failed (model £0, expected £1,000), though CI's 10 fixed examples never drew one. Set is_claimant_or_partner True for generated adults and False for children, as 207e225c6 did for other fixtures, here and in the State Pension property test, whose 18- or 19-year-old partner draws had stopped testing a mixed-age couple. Co-Authored-By: Claude Opus 5.5 --- changelog.d/uc-capital-income-property-roles.fixed.md | 1 + .../tests/test_uc_income_from_capital_properties.py | 7 +++++-- .../tests/test_uc_state_pension_properties.py | 11 +++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 changelog.d/uc-capital-income-property-roles.fixed.md diff --git a/changelog.d/uc-capital-income-property-roles.fixed.md b/changelog.d/uc-capital-income-property-roles.fixed.md new file mode 100644 index 0000000000..696d5a7757 --- /dev/null +++ b/changelog.d/uc-capital-income-property-roles.fixed.md @@ -0,0 +1 @@ +Gave the generated adults in the Universal Credit capital-income and State Pension property tests explicit claimant-or-partner roles, so an adult under 20 is no longer presumed to be the other adult's child. diff --git a/policyengine_uk/tests/test_uc_income_from_capital_properties.py b/policyengine_uk/tests/test_uc_income_from_capital_properties.py index 0bc207f5aa..6a2457cad9 100644 --- a/policyengine_uk/tests/test_uc_income_from_capital_properties.py +++ b/policyengine_uk/tests/test_uc_income_from_capital_properties.py @@ -115,7 +115,10 @@ def situation(units, year, income_scale=1.0, capital_bump=None): names = [] for j, age in enumerate(unit["ages"]): name = f"p{i}_{j}" - person = {"age": {year: age}} + # The generated adults are the claimant and partner, as the FRS + # would record them; without this an adult under 20 who is 16 or + # more years younger is presumed to be the other's child. + person = {"age": {year: age}, "is_claimant_or_partner": {year: True}} if j == 0: person["employment_income"] = {year: unit["earnings"]} person["private_pension_income"] = { @@ -128,7 +131,7 @@ def situation(units, year, income_scale=1.0, capital_bump=None): names.append(name) for k, age in enumerate(unit["children"]): name = f"c{i}_{k}" - people[name] = {"age": {year: age}} + people[name] = {"age": {year: age}, "is_claimant_or_partner": {year: False}} names.append(name) benunit = {"members": names} reported = unit["reported_capital"] diff --git a/policyengine_uk/tests/test_uc_state_pension_properties.py b/policyengine_uk/tests/test_uc_state_pension_properties.py index 70ee6af404..5e4115bcde 100644 --- a/policyengine_uk/tests/test_uc_state_pension_properties.py +++ b/policyengine_uk/tests/test_uc_state_pension_properties.py @@ -105,7 +105,14 @@ def situation(units, year, income_variable="state_pension", pension_bump=0.0): names = [] for j, age in enumerate(unit["ages"]): name = f"p{i}_{j}" - person = {"age": {year: age}, "state_pension": {year: 0.0}} + # The generated adults are the claimant and partner (a mixed-age + # couple can include an 18- or 19-year-old partner), as the FRS + # would record them. + person = { + "age": {year: age}, + "state_pension": {year: 0.0}, + "is_claimant_or_partner": {year: True}, + } if j == 0: amount = unit["state_pension"] + pension_bump person[income_variable] = {year: amount} @@ -115,7 +122,7 @@ def situation(units, year, income_variable="state_pension", pension_bump=0.0): names.append(name) for k, age in enumerate(unit["children"]): name = f"c{i}_{k}" - people[name] = {"age": {year: age}} + people[name] = {"age": {year: age}, "is_claimant_or_partner": {year: False}} names.append(name) benunits[f"b{i}"] = {"members": names} households[f"h{i}"] = {