|
8 | 8 | create_database, |
9 | 9 | ) |
10 | 10 | from policyengine_us_data.db.etl_national_targets import ( |
11 | | - TAX_EXPENDITURE_REFORM_ID, |
12 | 11 | load_national_targets, |
13 | 12 | ) |
14 | 13 |
|
@@ -90,13 +89,15 @@ def test_load_national_targets_deactivates_stale_baseline_rows(tmp_path, monkeyp |
90 | 89 | tax_expenditure_df = pd.DataFrame( |
91 | 90 | [ |
92 | 91 | { |
| 92 | + "reform_id": 1, |
93 | 93 | "variable": "salt_deduction", |
94 | 94 | "value": 21.247e9, |
95 | 95 | "source": "Joint Committee on Taxation", |
96 | 96 | "notes": "SALT deduction tax expenditure", |
97 | 97 | "year": 2024, |
98 | 98 | }, |
99 | 99 | { |
| 100 | + "reform_id": 5, |
100 | 101 | "variable": "qualified_business_income_deduction", |
101 | 102 | "value": 63.1e9, |
102 | 103 | "source": "Joint Committee on Taxation", |
@@ -124,16 +125,12 @@ def test_load_national_targets_deactivates_stale_baseline_rows(tmp_path, monkeyp |
124 | 125 | assert stale_rows |
125 | 126 | assert all(not target.active for target in stale_rows) |
126 | 127 |
|
127 | | - reform_rows = ( |
128 | | - session.query(Target) |
129 | | - .filter(Target.reform_id == TAX_EXPENDITURE_REFORM_ID) |
130 | | - .all() |
131 | | - ) |
| 128 | + reform_rows = session.query(Target).filter(Target.reform_id > 0).all() |
132 | 129 | assert len(reform_rows) == 2 |
133 | 130 | assert all(target.active for target in reform_rows) |
134 | | - assert {target.variable for target in reform_rows} == { |
135 | | - "salt_deduction", |
136 | | - "qualified_business_income_deduction", |
| 131 | + assert {(target.variable, target.reform_id) for target in reform_rows} == { |
| 132 | + ("salt_deduction", 1), |
| 133 | + ("qualified_business_income_deduction", 5), |
137 | 134 | } |
138 | 135 | assert all( |
139 | 136 | "Modeled as repeal-based income tax expenditure target" |
|
0 commit comments