Skip to content

Add unit tests for CPS marriage tax reforms (#737)#1642

Open
vahid-ahmadi wants to merge 1 commit intomainfrom
test/cps-marriage-tax-reforms-737
Open

Add unit tests for CPS marriage tax reforms (#737)#1642
vahid-ahmadi wants to merge 1 commit intomainfrom
test/cps-marriage-tax-reforms-737

Conversation

@vahid-ahmadi
Copy link
Copy Markdown
Collaborator

Summary

  • Exposes module-level Reform instances (expanded_ma_reform, marriage_neutral_it_reform) in policyengine_uk/reforms/cps/marriage_tax_reforms.py so YAML tests can reference them by dotted import path — matching the pattern used by scottish_child_payment_reform. Both are built with no child-age or education filters, so they apply to every married couple in tests.
  • Adds three initial test cases at policyengine_uk/tests/policy/reforms/cps/marriage_tax_reforms.yaml:
    • Expanded MA: single higher-rate earner — no MA (no spouse to transfer from).
    • Expanded MA: married higher-rate earner with a low-earning spouse — MA = £1,260 (low earner's unused PA capped at PA × ma_rate, rounded up to the £10 increment; take-up forced to 1.0).
    • Marriage-neutral IT: single person — adjusted_net_income unchanged (has_spouse False → optimal-split branch collapses to original income).

Closes #737.

Notes

  • I didn't run the tests locally — relying on CI. If values are off by a small amount or a test needs a different input, happy to iterate.
  • Scope is deliberately modest: three tests that exercise the core branches of each reform. Broader coverage (e.g. exact IT savings for an unequal-income couple under marriage-neutral IT) would be a natural follow-up.

Test plan

  • CI policyengine-core test run.
  • Sanity review of expected values if any test fails.

🤖 Generated with Claude Code

Expose module-level Reform instances (`expanded_ma_reform`,
`marriage_neutral_it_reform`) so YAML tests can reference them by
dotted import path, matching the existing pattern used by
`scottish_child_payment_reform`. Both are built with no child-age or
education filters, so they apply to every married couple in tests.

Add three initial test cases covering the reform mechanics:

- Expanded MA: a single higher-rate earner has no Marriage Allowance
  even with the reform active (no spouse to transfer from).
- Expanded MA: a married higher-rate earner with a low-earning spouse
  receives Marriage Allowance under the reform (normally ineligible
  under ITA 2007 s. 55B because they're over the basic rate). With
  take-up forced to 1.0, the expected transfer is £1,260 — low
  earner's unused PA capped at PA × ma_rate, rounded up to the £10
  increment.
- Marriage-neutral IT: a single person's adjusted net income is
  unchanged because `has_spouse` is False and the optimal-split
  branch collapses to the original income.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vahid-ahmadi vahid-ahmadi requested a review from MaxGhenis April 21, 2026 11:15
@vahid-ahmadi vahid-ahmadi self-assigned this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for CPS reforms

1 participant