From 5ed3df2cc8ffa8c55dba591480cc53995f7e6fef Mon Sep 17 00:00:00 2001 From: vahid-ahmadi Date: Wed, 25 Nov 2026 13:14:52 +0000 Subject: [PATCH] Put is_claimant_or_partner's rules in its documentation field The rules lived only in the class docstring, which core does not read, so the variable's metadata had no documentation text. Co-Authored-By: Claude Opus 5.5 --- changelog.d/claimant-or-partner-documentation.fixed.md | 1 + .../tests/test_claimant_or_partner_documentation.py | 9 +++++++++ .../household/demographic/is_claimant_or_partner.py | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 changelog.d/claimant-or-partner-documentation.fixed.md create mode 100644 policyengine_uk/tests/test_claimant_or_partner_documentation.py diff --git a/changelog.d/claimant-or-partner-documentation.fixed.md b/changelog.d/claimant-or-partner-documentation.fixed.md new file mode 100644 index 0000000000..ed087214ca --- /dev/null +++ b/changelog.d/claimant-or-partner-documentation.fixed.md @@ -0,0 +1 @@ +The rules for `is_claimant_or_partner` now appear in its variable metadata, not only in the class docstring. diff --git a/policyengine_uk/tests/test_claimant_or_partner_documentation.py b/policyengine_uk/tests/test_claimant_or_partner_documentation.py new file mode 100644 index 0000000000..77b7e61013 --- /dev/null +++ b/policyengine_uk/tests/test_claimant_or_partner_documentation.py @@ -0,0 +1,9 @@ +from policyengine_uk import CountryTaxBenefitSystem + + +def test_claimant_or_partner_documentation_reaches_variable_metadata(): + variable = CountryTaxBenefitSystem().get_variable("is_claimant_or_partner") + documentation = (variable.documentation or "").strip() + assert documentation.startswith("The single adult or couple a benefit unit") + assert "SSCBA 1992 s.137(1)" in documentation + assert "Any further adults are neither claimant nor partner." in documentation diff --git a/policyengine_uk/variables/household/demographic/is_claimant_or_partner.py b/policyengine_uk/variables/household/demographic/is_claimant_or_partner.py index 8163855ec5..9582dc180e 100644 --- a/policyengine_uk/variables/household/demographic/is_claimant_or_partner.py +++ b/policyengine_uk/variables/household/demographic/is_claimant_or_partner.py @@ -2,7 +2,8 @@ class is_claimant_or_partner(Variable): - """The single adult or couple a benefit unit is formed around. + documentation = """ + The single adult or couple a benefit unit is formed around. In benefit law this is the claimant and their partner, as opposed to the children and young persons they are responsible for (SSCBA 1992 s.137(1)