|
| 1 | +from policyengine_uk import Simulation |
| 2 | + |
| 3 | + |
| 4 | +def test_uc_capital_stocks_are_not_prorated_in_monthly_calculations(): |
| 5 | + situation = { |
| 6 | + "people": {"person": {"age": {"2026": 30}}}, |
| 7 | + "benunits": { |
| 8 | + "benunit": { |
| 9 | + "members": ["person"], |
| 10 | + "would_claim_uc": {"2026": True}, |
| 11 | + } |
| 12 | + }, |
| 13 | + "households": { |
| 14 | + "household": { |
| 15 | + "members": ["person"], |
| 16 | + "savings": {"2026": 12_000}, |
| 17 | + "other_residential_property_value": {"2026": 12_000}, |
| 18 | + "corporate_wealth": {"2026": 12_000}, |
| 19 | + } |
| 20 | + }, |
| 21 | + } |
| 22 | + simulation = Simulation(situation=situation) |
| 23 | + |
| 24 | + assert simulation.calculate("savings", "2026-01")[0] == 12_000 |
| 25 | + assert simulation.calculate("corporate_wealth", "2026-01")[0] == 12_000 |
| 26 | + assert simulation.calculate("uc_assessable_capital", "2026-01")[0] == 36_000 |
| 27 | + assert not simulation.calculate("is_uc_eligible", "2026-01")[0] |
| 28 | + |
| 29 | + |
| 30 | +def test_pension_credit_capital_stocks_are_not_prorated_monthly(): |
| 31 | + situation = { |
| 32 | + "people": {"person": {"age": {"2026": 70}}}, |
| 33 | + "benunits": {"benunit": {"members": ["person"]}}, |
| 34 | + "households": { |
| 35 | + "household": { |
| 36 | + "members": ["person"], |
| 37 | + "savings": {"2026": 12_000}, |
| 38 | + "owned_land": {"2026": 12_000}, |
| 39 | + "corporate_wealth": {"2026": 12_000}, |
| 40 | + } |
| 41 | + }, |
| 42 | + } |
| 43 | + simulation = Simulation(situation=situation) |
| 44 | + |
| 45 | + assert simulation.calculate("savings", "2026-01")[0] == 12_000 |
| 46 | + assert ( |
| 47 | + simulation.calculate("pension_credit_assessable_capital", "2026-01")[0] |
| 48 | + == 36_000 |
| 49 | + ) |
0 commit comments