Skip to content

Commit f510c20

Browse files
llennemannclaude
andcommitted
Add comprehensive unit tests for Iowa FIP variables
Add individual test files for each Iowa FIP variable following the Arizona TANF pattern from PR PolicyEngine#7150: - ia_fip_eligible.yaml (8 tests) - ia_fip_income_eligible.yaml (8 tests) - ia_fip_payment_standard.yaml (8 tests) - ia_fip_standard_of_need.yaml (8 tests) - ia_fip_countable_income.yaml (8 tests) - ia_fip_gross_income.yaml (6 tests) - ia_fip_gross_earned_income.yaml (7 tests) - ia_fip_gross_unearned_income.yaml (10 tests) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dc74f38 commit f510c20

File tree

8 files changed

+1480
-0
lines changed

8 files changed

+1480
-0
lines changed
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# Unit tests for Iowa FIP countable income
2+
# Countable income calculation:
3+
# 1. Apply 20% earned income deduction
4+
# 2. Apply 58% work incentive disregard to remaining earned income
5+
# 3. Add unearned income (no deductions)
6+
# Reference: https://www.legis.iowa.gov/docs/iac/chapter/01-07-2026.441.41.pdf
7+
8+
- name: Case 1, zero income.
9+
period: 2025
10+
input:
11+
people:
12+
person1:
13+
age: 30
14+
employment_income: 0
15+
spm_units:
16+
spm_unit:
17+
members: [person1]
18+
households:
19+
household:
20+
members: [person1]
21+
state_code: IA
22+
output:
23+
ia_fip_countable_income: 0
24+
25+
- name: Case 2, earned income only ($800/month).
26+
period: 2025
27+
absolute_error_margin: 0.01
28+
input:
29+
people:
30+
person1:
31+
age: 30
32+
employment_income: 9_600
33+
spm_units:
34+
spm_unit:
35+
members: [person1]
36+
households:
37+
household:
38+
members: [person1]
39+
state_code: IA
40+
output:
41+
# Gross earned: $9,600
42+
# 20% deduction: $9,600 * 0.20 = $1,920
43+
# Remaining: $9,600 - $1,920 = $7,680
44+
# 58% work incentive: $7,680 * 0.58 = $4,454.40
45+
# Countable earned: $7,680 - $4,454.40 = $3,225.60
46+
ia_fip_countable_income: 3_225.60
47+
48+
- name: Case 3, unearned income only.
49+
period: 2025
50+
input:
51+
people:
52+
person1:
53+
age: 30
54+
employment_income: 0
55+
social_security: 4_800
56+
spm_units:
57+
spm_unit:
58+
members: [person1]
59+
households:
60+
household:
61+
members: [person1]
62+
state_code: IA
63+
output:
64+
# Unearned income has no deductions
65+
# Countable = $4,800
66+
ia_fip_countable_income: 4_800
67+
68+
- name: Case 4, mixed earned and unearned income.
69+
period: 2025
70+
absolute_error_margin: 0.01
71+
input:
72+
people:
73+
person1:
74+
age: 30
75+
employment_income: 6_000
76+
social_security: 2_400
77+
spm_units:
78+
spm_unit:
79+
members: [person1]
80+
households:
81+
household:
82+
members: [person1]
83+
state_code: IA
84+
output:
85+
# Gross earned: $6,000
86+
# 20% deduction: $6,000 * 0.20 = $1,200
87+
# Remaining: $6,000 - $1,200 = $4,800
88+
# 58% work incentive: $4,800 * 0.58 = $2,784
89+
# Countable earned: $4,800 - $2,784 = $2,016
90+
# Total countable: $2,016 + $2,400 = $4,416
91+
ia_fip_countable_income: 4_416
92+
93+
- name: Case 5, low earned income ($600/month).
94+
period: 2025
95+
absolute_error_margin: 0.01
96+
input:
97+
people:
98+
person1:
99+
age: 25
100+
employment_income: 7_200
101+
spm_units:
102+
spm_unit:
103+
members: [person1]
104+
households:
105+
household:
106+
members: [person1]
107+
state_code: IA
108+
output:
109+
# Gross earned: $7,200
110+
# 20% deduction: $7,200 * 0.20 = $1,440
111+
# Remaining: $7,200 - $1,440 = $5,760
112+
# 58% work incentive: $5,760 * 0.58 = $3,340.80
113+
# Countable earned: $5,760 - $3,340.80 = $2,419.20
114+
ia_fip_countable_income: 2_419.20
115+
116+
- name: Case 6, high earned income ($2,000/month).
117+
period: 2025
118+
absolute_error_margin: 0.01
119+
input:
120+
people:
121+
person1:
122+
age: 30
123+
employment_income: 24_000
124+
spm_units:
125+
spm_unit:
126+
members: [person1]
127+
households:
128+
household:
129+
members: [person1]
130+
state_code: IA
131+
output:
132+
# Gross earned: $24,000
133+
# 20% deduction: $24,000 * 0.20 = $4,800
134+
# Remaining: $24,000 - $4,800 = $19,200
135+
# 58% work incentive: $19,200 * 0.58 = $11,136
136+
# Countable earned: $19,200 - $11,136 = $8,064
137+
ia_fip_countable_income: 8_064
138+
139+
- name: Case 7, multiple earners in household.
140+
period: 2025
141+
absolute_error_margin: 0.01
142+
input:
143+
people:
144+
person1:
145+
age: 35
146+
employment_income: 10_000
147+
person2:
148+
age: 33
149+
employment_income: 2_000
150+
spm_units:
151+
spm_unit:
152+
members: [person1, person2]
153+
households:
154+
household:
155+
members: [person1, person2]
156+
state_code: IA
157+
output:
158+
# Gross earned: $10,000 + $2,000 = $12,000
159+
# 20% deduction: $12,000 * 0.20 = $2,400
160+
# Remaining: $12,000 - $2,400 = $9,600
161+
# 58% work incentive: $9,600 * 0.58 = $5,568
162+
# Countable earned: $9,600 - $5,568 = $4,032
163+
ia_fip_countable_income: 4_032
164+
165+
- name: Case 8, non-Iowa state gets zero.
166+
period: 2025
167+
input:
168+
people:
169+
person1:
170+
age: 30
171+
employment_income: 9_600
172+
spm_units:
173+
spm_unit:
174+
members: [person1]
175+
households:
176+
household:
177+
members: [person1]
178+
state_code: IL
179+
output:
180+
# defined_for StateCode.IA, other states return 0
181+
ia_fip_countable_income: 0
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
# Unit tests for Iowa FIP eligibility
2+
# Requires: demographic eligibility (minor child), immigration eligibility,
3+
# resource eligibility, and income eligibility
4+
# Reference: https://www.legis.iowa.gov/docs/iac/chapter/01-07-2026.441.41.pdf
5+
6+
- name: Case 1, eligible family with minor child.
7+
period: 2025
8+
input:
9+
people:
10+
person1:
11+
age: 30
12+
employment_income: 0
13+
is_tax_unit_head: true
14+
person2:
15+
age: 5
16+
spm_units:
17+
spm_unit:
18+
members: [person1, person2]
19+
spm_unit_assets: 1_000
20+
tax_units:
21+
tax_unit:
22+
members: [person1, person2]
23+
households:
24+
household:
25+
members: [person1, person2]
26+
state_code: IA
27+
output:
28+
ia_fip_eligible: true
29+
30+
- name: Case 2, ineligible due to no minor child.
31+
period: 2025
32+
input:
33+
people:
34+
person1:
35+
age: 30
36+
employment_income: 0
37+
is_tax_unit_head: true
38+
spm_units:
39+
spm_unit:
40+
members: [person1]
41+
spm_unit_assets: 1_000
42+
tax_units:
43+
tax_unit:
44+
members: [person1]
45+
households:
46+
household:
47+
members: [person1]
48+
state_code: IA
49+
output:
50+
# Single adult without minor child fails demographic eligibility
51+
ia_fip_eligible: false
52+
53+
- name: Case 3, ineligible due to high income.
54+
period: 2025
55+
absolute_error_margin: 1
56+
input:
57+
people:
58+
person1:
59+
age: 30
60+
employment_income: 24_000
61+
is_tax_unit_head: true
62+
person2:
63+
age: 5
64+
spm_units:
65+
spm_unit:
66+
members: [person1, person2]
67+
spm_unit_assets: 1_000
68+
tax_units:
69+
tax_unit:
70+
members: [person1, person2]
71+
households:
72+
household:
73+
members: [person1, person2]
74+
state_code: IA
75+
output:
76+
# Gross income $24,000 > 185% of standard of need ($8,628 * 1.85 = $15,961.80)
77+
# Fails Test 1 (gross income test)
78+
ia_fip_eligible: false
79+
80+
- name: Case 4, ineligible due to high assets (applicant).
81+
period: 2025
82+
input:
83+
people:
84+
person1:
85+
age: 30
86+
employment_income: 0
87+
is_tax_unit_head: true
88+
person2:
89+
age: 5
90+
spm_units:
91+
spm_unit:
92+
members: [person1, person2]
93+
spm_unit_assets: 3_000
94+
tax_units:
95+
tax_unit:
96+
members: [person1, person2]
97+
households:
98+
household:
99+
members: [person1, person2]
100+
state_code: IA
101+
output:
102+
# $3,000 > $2,000 applicant resource limit
103+
ia_fip_eligible: false
104+
105+
- name: Case 5, recipient eligible with higher assets.
106+
period: 2025
107+
input:
108+
people:
109+
person1:
110+
age: 30
111+
employment_income: 0
112+
is_tax_unit_head: true
113+
person2:
114+
age: 5
115+
spm_units:
116+
spm_unit:
117+
members: [person1, person2]
118+
spm_unit_assets: 4_000
119+
is_tanf_enrolled: true
120+
tax_units:
121+
tax_unit:
122+
members: [person1, person2]
123+
households:
124+
household:
125+
members: [person1, person2]
126+
state_code: IA
127+
output:
128+
# Recipients have $5,000 limit, $4,000 < $5,000
129+
ia_fip_eligible: true
130+
131+
- name: Case 6, recipient ineligible with assets over limit.
132+
period: 2025
133+
input:
134+
people:
135+
person1:
136+
age: 30
137+
employment_income: 0
138+
is_tax_unit_head: true
139+
person2:
140+
age: 5
141+
spm_units:
142+
spm_unit:
143+
members: [person1, person2]
144+
spm_unit_assets: 6_000
145+
is_tanf_enrolled: true
146+
tax_units:
147+
tax_unit:
148+
members: [person1, person2]
149+
households:
150+
household:
151+
members: [person1, person2]
152+
state_code: IA
153+
output:
154+
# Recipients have $5,000 limit, $6,000 > $5,000
155+
ia_fip_eligible: false
156+
157+
- name: Case 7, eligible pregnant woman.
158+
period: 2025
159+
input:
160+
people:
161+
person1:
162+
age: 25
163+
employment_income: 0
164+
is_tax_unit_head: true
165+
is_pregnant: true
166+
spm_units:
167+
spm_unit:
168+
members: [person1]
169+
spm_unit_assets: 500
170+
tax_units:
171+
tax_unit:
172+
members: [person1]
173+
households:
174+
household:
175+
members: [person1]
176+
state_code: IA
177+
output:
178+
# Pregnant woman is demographically eligible
179+
ia_fip_eligible: true
180+
181+
- name: Case 8, eligible family with moderate income.
182+
period: 2025
183+
absolute_error_margin: 1
184+
input:
185+
people:
186+
person1:
187+
age: 30
188+
employment_income: 6_000
189+
is_tax_unit_head: true
190+
person2:
191+
age: 5
192+
person3:
193+
age: 3
194+
spm_units:
195+
spm_unit:
196+
members: [person1, person2, person3]
197+
spm_unit_assets: 1_500
198+
tax_units:
199+
tax_unit:
200+
members: [person1, person2, person3]
201+
households:
202+
household:
203+
members: [person1, person2, person3]
204+
state_code: IA
205+
output:
206+
# Family of 3 with $6,000/year earned income
207+
# Standard of need: $849 * 12 = $10,188
208+
# Gross income limit: $10,188 * 1.85 = $18,847.80 > $6,000 - PASS Test 1
209+
# 20% deduction: $6,000 * 0.20 = $1,200
210+
# Net income: $6,000 - $1,200 = $4,800 < $10,188 - PASS Test 2
211+
# Remaining earned: $4,800
212+
# 58% work incentive: $4,800 * 0.58 = $2,784
213+
# Countable income: $4,800 - $2,784 = $2,016 < $5,112 - PASS Test 3
214+
ia_fip_eligible: true

0 commit comments

Comments
 (0)