|
28 | 28 | _add_real_estate_tax_targets, |
29 | 29 | _add_ssi_recipient_targets, |
30 | 30 | _add_transfer_balance_targets, |
| 31 | + _cbo_program_target_value, |
31 | 32 | _get_medicaid_national_targets, |
32 | 33 | _get_aca_national_targets, |
33 | 34 | _load_aca_spending_and_enrollment_targets, |
|
39 | 40 | get_target_loss_weights, |
40 | 41 | ) |
41 | 42 | from policyengine_us_data.db import etl_national_targets |
42 | | -from policyengine_us_data.utils.ssi_targets import SSI_RECIPIENT_TARGETS_2024 |
| 43 | +from policyengine_us_data.utils.ssi_targets import ( |
| 44 | + SSI_RECIPIENT_TARGETS_2024, |
| 45 | + get_ssi_fiscal_year_payment_count, |
| 46 | + normalize_ssi_payment_target, |
| 47 | +) |
43 | 48 |
|
44 | 49 |
|
45 | 50 | def test_legacy_loss_targets_include_aggregate_qbi_deduction(): |
@@ -228,6 +233,27 @@ def map_result(self, values, source_entity, target_entity, how=None): |
228 | 233 | return np.asarray(values, dtype=np.float32) |
229 | 234 |
|
230 | 235 |
|
| 236 | +class _FakeCBOProgramTargetSimulation: |
| 237 | + def __init__(self): |
| 238 | + self.tax_benefit_system = SimpleNamespace( |
| 239 | + parameters=lambda period: SimpleNamespace( |
| 240 | + calibration=SimpleNamespace( |
| 241 | + gov=SimpleNamespace( |
| 242 | + cbo=SimpleNamespace( |
| 243 | + _children={ |
| 244 | + "income_tax": 2_000.0, |
| 245 | + "snap": 1_000.0, |
| 246 | + "social_security": 3_000.0, |
| 247 | + "ssi": 57_000_000_000.0, |
| 248 | + "unemployment_compensation": 4_000.0, |
| 249 | + } |
| 250 | + ) |
| 251 | + ) |
| 252 | + ) |
| 253 | + ) |
| 254 | + ) |
| 255 | + |
| 256 | + |
231 | 257 | class _FakeCapitalGainsSimulation: |
232 | 258 | def __init__(self): |
233 | 259 | self.calculate_calls = [] |
@@ -354,6 +380,28 @@ def test_add_ssi_recipient_targets_adds_total_and_age_counts(): |
354 | 380 | ) |
355 | 381 |
|
356 | 382 |
|
| 383 | +def test_ssi_payment_targets_normalize_fiscal_year_payment_timing(): |
| 384 | + assert get_ssi_fiscal_year_payment_count(2024) == 11 |
| 385 | + assert get_ssi_fiscal_year_payment_count(2025) == 12 |
| 386 | + assert get_ssi_fiscal_year_payment_count(2028) == 13 |
| 387 | + |
| 388 | + assert normalize_ssi_payment_target(57_000_000_000, 2024) == pytest.approx( |
| 389 | + 57_000_000_000 * 12 / 11 |
| 390 | + ) |
| 391 | + assert normalize_ssi_payment_target(75_400_000_000, 2028) == pytest.approx( |
| 392 | + 75_400_000_000 * 12 / 13 |
| 393 | + ) |
| 394 | + |
| 395 | + |
| 396 | +def test_legacy_cbo_ssi_target_uses_12_payment_equivalent(): |
| 397 | + sim = _FakeCBOProgramTargetSimulation() |
| 398 | + |
| 399 | + assert _cbo_program_target_value(sim, "ssi", 2024) == pytest.approx( |
| 400 | + 57_000_000_000 * 12 / 11 |
| 401 | + ) |
| 402 | + assert _cbo_program_target_value(sim, "snap", 2024) == 1_000.0 |
| 403 | + |
| 404 | + |
357 | 405 | def test_add_ctc_targets(monkeypatch): |
358 | 406 | monkeypatch.setattr( |
359 | 407 | "policyengine_us_data.utils.loss.get_national_geography_soi_target", |
|
0 commit comments