taxcalc 4.6.3__py3-none-any.whl → 5.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- taxcalc/__init__.py +1 -1
- taxcalc/calcfunctions.py +295 -684
- taxcalc/calculator.py +12 -9
- taxcalc/consumption.json +0 -16
- taxcalc/growdiff.json +2 -18
- taxcalc/parameters.py +1 -4
- taxcalc/policy.py +45 -30
- taxcalc/policy_current_law.json +4416 -7535
- taxcalc/records.py +3 -0
- taxcalc/records_variables.json +34 -40
- taxcalc/reforms/2017_law.json +1 -15
- taxcalc/reforms/ARPA.json +6 -6
- taxcalc/reforms/Larson2019.json +3 -3
- taxcalc/reforms/TCJA.json +2 -30
- taxcalc/reforms/Trump2016.json +1 -16
- taxcalc/reforms/Trump2017.json +1 -10
- taxcalc/reforms/ext.json +1 -15
- taxcalc/tests/conftest.py +2 -2
- taxcalc/tests/pufcsv_agg_expect.csv +2 -2
- taxcalc/tests/reforms.json +37 -89
- taxcalc/tests/reforms_expect.csv +32 -35
- taxcalc/tests/test_calcfunctions.py +94 -17
- taxcalc/tests/test_calculator.py +9 -81
- taxcalc/tests/test_compatible_data.py +0 -6
- taxcalc/tests/test_parameters.py +31 -19
- taxcalc/tests/test_policy.py +5 -31
- taxcalc/tests/test_pufcsv.py +0 -56
- taxcalc/tests/test_reforms.py +2 -2
- taxcalc/tests/test_utils.py +59 -59
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.4.dist-info}/METADATA +1 -1
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.4.dist-info}/RECORD +35 -35
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.4.dist-info}/WHEEL +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.4.dist-info}/entry_points.txt +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.4.dist-info}/licenses/LICENSE +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.4.dist-info}/top_level.txt +0 -0
taxcalc/tests/test_calculator.py
CHANGED
@@ -181,40 +181,6 @@ def test_calculator_mtr(cps_subsample):
|
|
181
181
|
assert np.allclose(calc.array('c00100'), c00100x)
|
182
182
|
|
183
183
|
|
184
|
-
def test_calculator_mtr_when_PT_rates_differ():
|
185
|
-
"""
|
186
|
-
Test Calculator mtr method in special case.
|
187
|
-
"""
|
188
|
-
reform = {
|
189
|
-
'II_rt1': {2013: 0.40},
|
190
|
-
'II_rt2': {2013: 0.40},
|
191
|
-
'II_rt3': {2013: 0.40},
|
192
|
-
'II_rt4': {2013: 0.40},
|
193
|
-
'II_rt5': {2013: 0.40},
|
194
|
-
'II_rt6': {2013: 0.40},
|
195
|
-
'II_rt7': {2013: 0.40},
|
196
|
-
'PT_rt1': {2013: 0.30},
|
197
|
-
'PT_rt2': {2013: 0.30},
|
198
|
-
'PT_rt3': {2013: 0.30},
|
199
|
-
'PT_rt4': {2013: 0.30},
|
200
|
-
'PT_rt5': {2013: 0.30},
|
201
|
-
'PT_rt6': {2013: 0.30},
|
202
|
-
'PT_rt7': {2013: 0.30}
|
203
|
-
}
|
204
|
-
funit = (
|
205
|
-
'RECID,MARS,FLPDYR,e00200,e00200p,e00900,e00900p,extraneous\n'
|
206
|
-
'1, 1, 2009, 200000,200000, 100000,100000, 9999999999\n'
|
207
|
-
)
|
208
|
-
rec = Records(pd.read_csv(StringIO(funit)))
|
209
|
-
pol = Policy()
|
210
|
-
calc1 = Calculator(policy=pol, records=rec)
|
211
|
-
(_, mtr1, _) = calc1.mtr(variable_str='p23250')
|
212
|
-
pol.implement_reform(reform)
|
213
|
-
calc2 = Calculator(policy=pol, records=rec)
|
214
|
-
(_, mtr2, _) = calc2.mtr(variable_str='p23250')
|
215
|
-
assert np.allclose(mtr1, mtr2, rtol=0.0, atol=1e-06)
|
216
|
-
|
217
|
-
|
218
184
|
def test_make_calculator_increment_years_first(cps_subsample):
|
219
185
|
"""
|
220
186
|
Test Calculator inflation indexing of policy parameters.
|
@@ -252,44 +218,6 @@ def test_make_calculator_increment_years_first(cps_subsample):
|
|
252
218
|
assert np.allclose(act_II_em[:5], exp_II_em)
|
253
219
|
|
254
220
|
|
255
|
-
def test_ID_HC_vs_BS(cps_subsample):
|
256
|
-
"""
|
257
|
-
Test that complete haircut of itemized deductions produces same
|
258
|
-
results as a 100% benefit surtax with no benefit deduction.
|
259
|
-
"""
|
260
|
-
recs = Records.cps_constructor(data=cps_subsample)
|
261
|
-
# specify complete-haircut reform policy and Calculator object
|
262
|
-
hc_policy = Policy()
|
263
|
-
hc_reform = {
|
264
|
-
'ID_Medical_hc': {2013: 1.0},
|
265
|
-
'ID_StateLocalTax_hc': {2013: 1.0},
|
266
|
-
'ID_RealEstate_hc': {2013: 1.0},
|
267
|
-
'ID_Casualty_hc': {2013: 1.0},
|
268
|
-
'ID_Miscellaneous_hc': {2013: 1.0},
|
269
|
-
'ID_InterestPaid_hc': {2013: 1.0},
|
270
|
-
'ID_Charity_hc': {2013: 1.0}
|
271
|
-
}
|
272
|
-
hc_policy.implement_reform(hc_reform)
|
273
|
-
hc_calc = Calculator(policy=hc_policy, records=recs)
|
274
|
-
hc_calc.calc_all()
|
275
|
-
hc_taxes = hc_calc.dataframe(['iitax', 'payrolltax'])
|
276
|
-
del hc_calc
|
277
|
-
# specify benefit-surtax reform policy and Calculator object
|
278
|
-
bs_policy = Policy()
|
279
|
-
bs_reform = {
|
280
|
-
'ID_BenefitSurtax_crt': {2013: 0.0},
|
281
|
-
'ID_BenefitSurtax_trt': {2013: 1.0}
|
282
|
-
}
|
283
|
-
bs_policy.implement_reform(bs_reform)
|
284
|
-
bs_calc = Calculator(policy=bs_policy, records=recs)
|
285
|
-
bs_calc.calc_all()
|
286
|
-
bs_taxes = bs_calc.dataframe([], all_vars=True)
|
287
|
-
del bs_calc
|
288
|
-
# compare calculated taxes generated by the two reforms
|
289
|
-
assert np.allclose(hc_taxes['payrolltax'], bs_taxes['payrolltax'])
|
290
|
-
assert np.allclose(hc_taxes['iitax'], bs_taxes['iitax'])
|
291
|
-
|
292
|
-
|
293
221
|
def test_ID_StateLocal_HC_vs_CRT(cps_subsample):
|
294
222
|
"""
|
295
223
|
Test that a cap on state/local income and sales tax deductions at 0 percent
|
@@ -345,11 +273,11 @@ def test_ID_RealEstate_HC_vs_CRT(cps_subsample):
|
|
345
273
|
RAWINPUT_FUNITS = 4
|
346
274
|
RAWINPUT_YEAR = 2015
|
347
275
|
RAWINPUT_CONTENTS = (
|
348
|
-
'RECID,MARS,unknown\n'
|
349
|
-
' 1, 2, 9\n'
|
350
|
-
' 2, 1, 9\n'
|
351
|
-
' 3, 4, 9\n'
|
352
|
-
' 4, 3, 9\n'
|
276
|
+
'RECID,MARS,unknown,e00300\n'
|
277
|
+
' 1, 2, 9, 0\n'
|
278
|
+
' 2, 1, 9, 0\n'
|
279
|
+
' 3, 4, 9, 0\n'
|
280
|
+
' 4, 3, 9, 0\n'
|
353
281
|
)
|
354
282
|
|
355
283
|
|
@@ -384,6 +312,9 @@ def test_calculator_using_nonstd_input():
|
|
384
312
|
exp_mtr_ptax = np.zeros((nonstd.array_length,))
|
385
313
|
exp_mtr_ptax.fill(0.153)
|
386
314
|
assert np.allclose(mtr_ptax, exp_mtr_ptax)
|
315
|
+
# misc calls for code coverage
|
316
|
+
calc.incarray('e00300', np.ones_like(calc.array('e00300')))
|
317
|
+
calc.policy_param('ID_c', param_value=50e3)
|
387
318
|
|
388
319
|
|
389
320
|
def test_bad_json_names(tests_path):
|
@@ -605,9 +536,6 @@ def test_reform_documentation():
|
|
605
536
|
"STD_Aged": {
|
606
537
|
"2016": [1600, 1300, 1300, 1600, 1600],
|
607
538
|
"2020": [2000, 2000, 2000, 2000, 2000]
|
608
|
-
},
|
609
|
-
"ID_BenefitCap_Switch": {
|
610
|
-
"2020": [false, false, false, false, false, false, false]
|
611
539
|
}
|
612
540
|
}
|
613
541
|
"""
|
@@ -883,7 +811,7 @@ def test_qbid_calculation():
|
|
883
811
|
assert calc.current_year == TPC_YEAR
|
884
812
|
calc.calc_all()
|
885
813
|
varlist = ['RECID', 'c00100', 'standard', 'c04470', 'qbided']
|
886
|
-
tc_df = calc.dataframe(varlist)
|
814
|
+
tc_df = calc.dataframe(varlist, all_vars=True)
|
887
815
|
# compare actual amounts with expected amounts from TPC publication
|
888
816
|
act_taxinc = tc_df.c00100 - np.maximum(tc_df.standard, tc_df.c04470)
|
889
817
|
exp_taxinc = tpc_df.pre_qbid_taxinc
|
@@ -97,12 +97,9 @@ def fixture_reform_xx():
|
|
97
97
|
'CTC_new_refund_limited': True,
|
98
98
|
'CTC_new_refund_limit_payroll_rt': 1,
|
99
99
|
'ACTC_ChildNum': 1,
|
100
|
-
'ID_BenefitSurtax_trt': 0.1,
|
101
|
-
'ID_BenefitSurtax_crt': 0.1,
|
102
100
|
'UBI_u18': 1000,
|
103
101
|
'UBI_1820': 1000,
|
104
102
|
'UBI_21': 1000,
|
105
|
-
'PT_brk7': [1000000, 1000000, 1000000, 1000000, 1000000],
|
106
103
|
'II_credit_prt': 0.1,
|
107
104
|
'II_credit': [100, 100, 100, 100, 100],
|
108
105
|
'CG_brk3': [1000000, 1000000, 1000000, 1000000, 1000000],
|
@@ -112,10 +109,7 @@ def fixture_reform_xx():
|
|
112
109
|
'AMT_CG_brk3': [500000, 500000, 500000, 500000, 500000],
|
113
110
|
'AGI_surtax_thd': [1000000, 1000000, 1000000, 1000000, 1000000],
|
114
111
|
'AGI_surtax_trt': 0.5,
|
115
|
-
'ID_AmountCap_rt': 0.9,
|
116
112
|
'II_brk7': [1000000, 1000000, 1000000, 1000000, 1000000],
|
117
|
-
'ID_BenefitCap_rt': 0.3,
|
118
|
-
'PT_rt7': 0.35,
|
119
113
|
'II_em': 1000,
|
120
114
|
'ID_Casualty_hc': 0.1,
|
121
115
|
'ID_Miscellaneous_hc': 0.1,
|
taxcalc/tests/test_parameters.py
CHANGED
@@ -113,6 +113,7 @@ def fixture_params_json_file():
|
|
113
113
|
({'str_param': {2004: ['nonlinear']}}, "raise"),
|
114
114
|
({'real_param': {2004: 'linear'}}, "raise"),
|
115
115
|
({'real_param': {2004: [0.2, 0.3]}}, "raise"),
|
116
|
+
({'removed_param': {2004: 0.1}}, "raise"),
|
116
117
|
({'real_param-indexed': {2004: True}}, "raise"),
|
117
118
|
({'unknown_param-indexed': {2004: False}}, "raise")
|
118
119
|
])
|
@@ -132,6 +133,9 @@ def test_params_class(revision, expect, params_json_file):
|
|
132
133
|
START_YEAR = 2001
|
133
134
|
LAST_YEAR = 2010
|
134
135
|
NUM_YEARS = LAST_YEAR - START_YEAR + 1
|
136
|
+
REMOVED_PARAMS = {
|
137
|
+
'removed_param': 'has been removed'
|
138
|
+
}
|
135
139
|
|
136
140
|
def __init__(self):
|
137
141
|
super().__init__()
|
@@ -319,10 +323,17 @@ class ArrayParams(Parameters):
|
|
319
323
|
}
|
320
324
|
}
|
321
325
|
},
|
322
|
-
"
|
326
|
+
"EIC": {
|
323
327
|
"type": "str",
|
324
328
|
"validators": {
|
325
|
-
"choice": {
|
329
|
+
"choice": {
|
330
|
+
"choices": [
|
331
|
+
"0kids",
|
332
|
+
"1kid",
|
333
|
+
"2kids",
|
334
|
+
"3+kids"
|
335
|
+
]
|
336
|
+
}
|
326
337
|
}
|
327
338
|
}
|
328
339
|
},
|
@@ -340,23 +351,24 @@ class ArrayParams(Parameters):
|
|
340
351
|
}
|
341
352
|
},
|
342
353
|
"one_dim": {
|
343
|
-
"title": "One
|
354
|
+
"title": "One dimensional parameter",
|
344
355
|
"description": "",
|
345
356
|
"type": "float",
|
346
357
|
"indexed": True,
|
347
358
|
"indexable": True,
|
348
359
|
"value": [{"year": 2013, "value": 5}]
|
349
360
|
},
|
350
|
-
"
|
351
|
-
"title": "Two
|
361
|
+
"EITC_c": {
|
362
|
+
"title": "Two dimensional parameter",
|
352
363
|
"description": "",
|
353
364
|
"type": "float",
|
354
365
|
"indexed": True,
|
355
366
|
"indexable": True,
|
356
367
|
"value": [
|
357
|
-
{"year": 2013, "
|
358
|
-
{"year": 2013, "
|
359
|
-
{"year": 2013, "
|
368
|
+
{"year": 2013, "EIC": "0kids", "value": 1},
|
369
|
+
{"year": 2013, "EIC": "1kid", "value": 2},
|
370
|
+
{"year": 2013, "EIC": "2kids", "value": 3},
|
371
|
+
{"year": 2013, "EIC": "3+kids", "value": 4}
|
360
372
|
]
|
361
373
|
},
|
362
374
|
"II_brk2": {
|
@@ -450,21 +462,21 @@ def test_expand_2d_short_array():
|
|
450
462
|
"""
|
451
463
|
One of several _expand_?D tests.
|
452
464
|
"""
|
453
|
-
val = np.array([1., 2., 3.])
|
465
|
+
val = np.array([1., 2., 3., 4.])
|
454
466
|
exp2 = np.array([val * math.pow(1.02, i) for i in range(1, 5)])
|
455
|
-
exp1 = np.array([1., 2., 3.])
|
456
|
-
exp = np.zeros((5,
|
467
|
+
exp1 = np.array([1., 2., 3., 4.])
|
468
|
+
exp = np.zeros((5, 4))
|
457
469
|
exp[:1] = exp1
|
458
470
|
exp[1:] = exp2
|
459
471
|
|
460
472
|
params = ArrayParams(array_first=False, label_to_extend=None)
|
461
473
|
years = [2013, 2014, 2015, 2016, 2017]
|
462
474
|
params.extend(
|
463
|
-
params=["
|
475
|
+
params=["EITC_c"],
|
464
476
|
label="year",
|
465
477
|
label_values=years,
|
466
478
|
)
|
467
|
-
res = params.to_array("
|
479
|
+
res = params.to_array("EITC_c", year=years)
|
468
480
|
assert np.allclose(exp, res, atol=0.01, rtol=0.0)
|
469
481
|
|
470
482
|
|
@@ -472,8 +484,8 @@ def test_expand_2d_variable_rates():
|
|
472
484
|
"""
|
473
485
|
One of several _expand_?D tests.
|
474
486
|
"""
|
475
|
-
ary = np.array([[1., 2., 3.]])
|
476
|
-
cur = np.array([1., 2., 3.])
|
487
|
+
ary = np.array([[1., 2., 3., 4.]])
|
488
|
+
cur = np.array([1., 2., 3., 4.])
|
477
489
|
irates = [0.02, 0.02, 0.02, 0.03, 0.035]
|
478
490
|
exp2 = []
|
479
491
|
for i in range(0, 4):
|
@@ -481,16 +493,16 @@ def test_expand_2d_variable_rates():
|
|
481
493
|
cur = np.array(cur * (1.0 + irates[idx]))
|
482
494
|
print('cur is ', cur)
|
483
495
|
exp2.append(cur)
|
484
|
-
exp1 = np.array([1., 2., 3.])
|
485
|
-
exp = np.zeros((5,
|
496
|
+
exp1 = np.array([1., 2., 3., 4.])
|
497
|
+
exp = np.zeros((5, 4))
|
486
498
|
exp[:1] = exp1
|
487
499
|
exp[1:] = exp2
|
488
500
|
|
489
501
|
params = ArrayParams(array_first=False, label_to_extend=None)
|
490
502
|
params._inflation_rates = irates
|
491
503
|
years = [2013, 2014, 2015, 2016, 2017]
|
492
|
-
params.extend(params=["
|
493
|
-
res = params.to_array("
|
504
|
+
params.extend(params=["EITC_c"], label="year", label_values=years)
|
505
|
+
res = params.to_array("EITC_c", year=years)
|
494
506
|
assert np.allclose(exp, res, atol=0.01, rtol=0.0)
|
495
507
|
|
496
508
|
|
taxcalc/tests/test_policy.py
CHANGED
@@ -640,8 +640,6 @@ def test_section_titles(tests_path):
|
|
640
640
|
return sdict
|
641
641
|
# begin main logic of test_section_titles
|
642
642
|
# specify expected section titles ordered as on the Tax-Brain webapp
|
643
|
-
ided_ceiling_pct = ('Ceiling On The Benefit Of Itemized Deductions '
|
644
|
-
'As A Percent Of Deductible Expenses')
|
645
643
|
cgqd_tax_same = ('Tax All Capital Gains And Dividends The Same '
|
646
644
|
'As Regular Taxable Income')
|
647
645
|
valid_dict = {
|
@@ -694,10 +692,8 @@ def test_section_titles(tests_path):
|
|
694
692
|
'Charity': 0,
|
695
693
|
'Casualty': 0,
|
696
694
|
'Miscellaneous': 0,
|
697
|
-
'Itemized Deduction Limitation': 0,
|
698
|
-
'
|
699
|
-
ided_ceiling_pct: 0,
|
700
|
-
'Ceiling On The Amount Of Itemized Deductions Allowed': 0
|
695
|
+
'Itemized Deduction Limitation': 0, # Pease
|
696
|
+
'Ceiling On The Amount Of Itemized Deductions Allowed': 0 # ID_c
|
701
697
|
},
|
702
698
|
'Capital Gains And Dividends': {
|
703
699
|
'Regular - Long Term Capital Gains And Qualified Dividends': 0,
|
@@ -705,7 +701,7 @@ def test_section_titles(tests_path):
|
|
705
701
|
cgqd_tax_same: 0
|
706
702
|
},
|
707
703
|
'Personal Income': {
|
708
|
-
'Regular: Non-AMT
|
704
|
+
'Regular: Non-AMT': 0,
|
709
705
|
'Pass-Through': 0,
|
710
706
|
'Alternative Minimum Tax': 0
|
711
707
|
},
|
@@ -835,7 +831,7 @@ def test_reform_with_out_of_range_error():
|
|
835
831
|
Try to use out-of-range values versus other parameter values in a reform.
|
836
832
|
"""
|
837
833
|
pol = Policy()
|
838
|
-
reform = {'
|
834
|
+
reform = {'SS_thd2': {2020: [20000, 20000, 20000, 20000, 20000]}}
|
839
835
|
pol.implement_reform(reform, raise_errors=False)
|
840
836
|
assert pol.parameter_errors
|
841
837
|
|
@@ -868,7 +864,7 @@ def test_reform_with_scalar_vector_errors():
|
|
868
864
|
Test catching scalar-vector confusion.
|
869
865
|
"""
|
870
866
|
policy1 = Policy()
|
871
|
-
reform1 = {'
|
867
|
+
reform1 = {'SS_thd2': {2020: 30000}}
|
872
868
|
with pytest.raises(paramtools.ValidationError):
|
873
869
|
policy1.implement_reform(reform1)
|
874
870
|
|
@@ -1519,28 +1515,6 @@ def test_cpi_offset_does_not_affect_wage_indexed_params():
|
|
1519
1515
|
np.testing.assert_equal(act_before_2025, exp_before_2025)
|
1520
1516
|
|
1521
1517
|
|
1522
|
-
def test_two_sets_of_tax_brackets():
|
1523
|
-
"""
|
1524
|
-
Test that II_brk? and PT_brk? values are the same under current law.
|
1525
|
-
"""
|
1526
|
-
pol = Policy()
|
1527
|
-
brackets = range(1, 7 + 1)
|
1528
|
-
years = range(Policy.JSON_START_YEAR, Policy.LAST_KNOWN_YEAR + 1)
|
1529
|
-
emsg = ''
|
1530
|
-
for year in years:
|
1531
|
-
pol.set_year(year)
|
1532
|
-
pdata = dict(pol.items())
|
1533
|
-
for bnum in brackets:
|
1534
|
-
ii_val = pdata[f'II_brk{bnum}']
|
1535
|
-
pt_val = pdata[f'PT_brk{bnum}']
|
1536
|
-
if not np.allclose(ii_val, pt_val):
|
1537
|
-
emsg += f'II_brk{bnum} != PT_brk{bnum} for year {year}\n'
|
1538
|
-
emsg += f' II_brk{bnum} is {ii_val}\n'
|
1539
|
-
emsg += f' PT_brk{bnum} is {pt_val}\n'
|
1540
|
-
if emsg:
|
1541
|
-
raise ValueError(emsg)
|
1542
|
-
|
1543
|
-
|
1544
1518
|
def test_ext_plus_ctc1_reform(tests_path):
|
1545
1519
|
"""
|
1546
1520
|
Test ext.json plus ctc1 compound reform relative to ext.json baseline.
|
taxcalc/tests/test_pufcsv.py
CHANGED
@@ -272,62 +272,6 @@ def test_mtr(tests_path, puf_path):
|
|
272
272
|
raise ValueError(msg)
|
273
273
|
|
274
274
|
|
275
|
-
@pytest.mark.requires_pufcsv
|
276
|
-
def test_mtr_pt_active(puf_subsample):
|
277
|
-
"""
|
278
|
-
Test whether including wages in active income causes
|
279
|
-
MTRs on e00900p and e26270 to be less than -1 (i.e., -100%)
|
280
|
-
"""
|
281
|
-
# pylint: disable=too-many-locals
|
282
|
-
rec = Records(data=puf_subsample)
|
283
|
-
reform_year = 2018
|
284
|
-
# create current-law Calculator object, calc1
|
285
|
-
pol1 = Policy()
|
286
|
-
calc1 = Calculator(policy=pol1, records=rec)
|
287
|
-
calc1.advance_to_year(reform_year)
|
288
|
-
calc1.calc_all()
|
289
|
-
mtr1_e00900p = calc1.mtr('e00900p')[2]
|
290
|
-
mtr1_e26270 = calc1.mtr('e26270')[2]
|
291
|
-
assert min(mtr1_e00900p) > -1
|
292
|
-
assert min(mtr1_e26270) > -1
|
293
|
-
# change PT rates, calc2
|
294
|
-
reform2 = {'PT_rt7': {reform_year: 0.35}}
|
295
|
-
pol2 = Policy()
|
296
|
-
pol2.implement_reform(reform2)
|
297
|
-
calc2 = Calculator(policy=pol2, records=rec)
|
298
|
-
calc2.advance_to_year(reform_year)
|
299
|
-
calc2.calc_all()
|
300
|
-
mtr2_e00900p = calc2.mtr('e00900p')[2]
|
301
|
-
mtr2_e26270 = calc2.mtr('e26270')[2]
|
302
|
-
assert min(mtr2_e00900p) > -1
|
303
|
-
assert min(mtr2_e26270) > -1
|
304
|
-
# change PT_wages_active_income
|
305
|
-
reform3 = {'PT_wages_active_income': {reform_year: True}}
|
306
|
-
pol3 = Policy()
|
307
|
-
pol3.implement_reform(reform3)
|
308
|
-
calc3 = Calculator(policy=pol3, records=rec)
|
309
|
-
calc3.advance_to_year(reform_year)
|
310
|
-
calc3.calc_all()
|
311
|
-
mtr3_e00900p = calc3.mtr('e00900p')[2]
|
312
|
-
mtr3_e26270 = calc3.mtr('e26270')[2]
|
313
|
-
assert min(mtr3_e00900p) > -1
|
314
|
-
assert min(mtr3_e26270) > -1
|
315
|
-
# change PT rates and PT_wages_active_income
|
316
|
-
reform4 = {
|
317
|
-
'PT_wages_active_income': {reform_year: True},
|
318
|
-
'PT_rt7': {reform_year: 0.35}
|
319
|
-
}
|
320
|
-
pol4 = Policy()
|
321
|
-
pol4.implement_reform(reform4)
|
322
|
-
calc4 = Calculator(policy=pol4, records=rec)
|
323
|
-
calc4.advance_to_year(reform_year)
|
324
|
-
calc4.calc_all()
|
325
|
-
mtr4_e00900p = calc4.mtr('e00900p')[2]
|
326
|
-
mtr4_e26270 = calc4.mtr('e26270')[2]
|
327
|
-
assert min(mtr4_e00900p) > -1
|
328
|
-
assert min(mtr4_e26270) > -1
|
329
|
-
|
330
|
-
|
331
275
|
@pytest.mark.requires_pufcsv
|
332
276
|
def test_credit_reforms(puf_subsample):
|
333
277
|
"""
|
taxcalc/tests/test_reforms.py
CHANGED
@@ -37,7 +37,7 @@ def test_2017_law_reform(tests_path):
|
|
37
37
|
# relation '>' implies asserting that actual > expect
|
38
38
|
# ... parameters not affected by TCJA and that are not indexed
|
39
39
|
'AMEDT_ec': {'relation': '=', 'value': 200000},
|
40
|
-
'
|
40
|
+
'SS_thd2': {'relation': '=', 'value': 34000},
|
41
41
|
# ... parameters not affected by TCJA and that are indexed
|
42
42
|
'STD_Dep': {'relation': '>', 'value': 1050},
|
43
43
|
'CG_brk2': {'relation': '>', 'value': 425400},
|
@@ -338,7 +338,7 @@ def fixture_reforms_dict(tests_path):
|
|
338
338
|
return json.loads(rjson)
|
339
339
|
|
340
340
|
|
341
|
-
NUM_REFORMS =
|
341
|
+
NUM_REFORMS = 60 # when changing this also change num_reforms in conftest.py
|
342
342
|
|
343
343
|
|
344
344
|
@pytest.mark.requires_pufcsv
|
taxcalc/tests/test_utils.py
CHANGED
@@ -98,9 +98,9 @@ def test_create_tables(cps_subsample):
|
|
98
98
|
np.nan,
|
99
99
|
-0.1,
|
100
100
|
-0.5,
|
101
|
-
-0.7,
|
102
|
-
-0.7,
|
103
101
|
-0.8,
|
102
|
+
-0.8,
|
103
|
+
-0.9,
|
104
104
|
-0.7,
|
105
105
|
-0.7,
|
106
106
|
-0.7,
|
@@ -125,17 +125,17 @@ def test_create_tables(cps_subsample):
|
|
125
125
|
0.0,
|
126
126
|
0.6,
|
127
127
|
2.9,
|
128
|
-
|
129
|
-
4.
|
130
|
-
6.
|
131
|
-
|
132
|
-
|
133
|
-
12.
|
134
|
-
13.
|
135
|
-
|
128
|
+
4.1,
|
129
|
+
4.9,
|
130
|
+
6.6,
|
131
|
+
7.1,
|
132
|
+
9.1,
|
133
|
+
12.3,
|
134
|
+
13.6,
|
135
|
+
61.2,
|
136
136
|
7.7,
|
137
|
-
|
138
|
-
0.
|
137
|
+
5.0,
|
138
|
+
0.9]
|
139
139
|
if not np.allclose(diff[tabcol].values.astype('float'), expected,
|
140
140
|
atol=0.1, rtol=0.0):
|
141
141
|
test_failure = True
|
@@ -147,19 +147,19 @@ def test_create_tables(cps_subsample):
|
|
147
147
|
expected = [0.0,
|
148
148
|
0.0,
|
149
149
|
0.0,
|
150
|
-
|
151
|
-
|
152
|
-
6.
|
153
|
-
|
154
|
-
10.
|
155
|
-
11.
|
156
|
-
|
157
|
-
20.
|
158
|
-
22.
|
150
|
+
0.9,
|
151
|
+
4.8,
|
152
|
+
6.7,
|
153
|
+
8.0,
|
154
|
+
10.7,
|
155
|
+
11.6,
|
156
|
+
14.8,
|
157
|
+
20.1,
|
158
|
+
22.3,
|
159
159
|
100.0,
|
160
|
-
|
161
|
-
8.
|
162
|
-
1.
|
160
|
+
12.6,
|
161
|
+
8.2,
|
162
|
+
1.5]
|
163
163
|
if not np.allclose(diff[tabcol].values.astype('float'), expected,
|
164
164
|
atol=0.1, rtol=0.0):
|
165
165
|
test_failure = True
|
@@ -173,13 +173,13 @@ def test_create_tables(cps_subsample):
|
|
173
173
|
-0.0,
|
174
174
|
-0.3,
|
175
175
|
-0.8,
|
176
|
-
-0.7,
|
177
|
-
-0.7,
|
178
176
|
-0.8,
|
177
|
+
-0.8,
|
178
|
+
-0.9,
|
179
179
|
-0.7,
|
180
180
|
-0.7,
|
181
|
-
-0.
|
182
|
-
-0.
|
181
|
+
-0.8,
|
182
|
+
-0.4,
|
183
183
|
-0.6,
|
184
184
|
-0.7,
|
185
185
|
-0.4,
|
@@ -200,18 +200,18 @@ def test_create_tables(cps_subsample):
|
|
200
200
|
0.0,
|
201
201
|
-0.3,
|
202
202
|
-3.8,
|
203
|
-
-5.
|
204
|
-
|
205
|
-
|
206
|
-
34.
|
207
|
-
|
208
|
-
|
209
|
-
159.
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
278.
|
214
|
-
489.
|
203
|
+
-5.3,
|
204
|
+
15.4,
|
205
|
+
22.3,
|
206
|
+
34.8,
|
207
|
+
33.6,
|
208
|
+
76.1,
|
209
|
+
159.7,
|
210
|
+
931.0,
|
211
|
+
1263.5,
|
212
|
+
163.0,
|
213
|
+
278.2,
|
214
|
+
489.8]
|
215
215
|
if not np.allclose(dist[tabcol].values.astype('float'), expected,
|
216
216
|
atol=0.1, rtol=0.0):
|
217
217
|
test_failure = True
|
@@ -273,17 +273,17 @@ def test_create_tables(cps_subsample):
|
|
273
273
|
29.0,
|
274
274
|
195.5,
|
275
275
|
363.0,
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
980.
|
280
|
-
|
281
|
-
|
282
|
-
3741.
|
283
|
-
|
276
|
+
490.4,
|
277
|
+
611.7,
|
278
|
+
746.6,
|
279
|
+
980.0,
|
280
|
+
1247.7,
|
281
|
+
1629.9,
|
282
|
+
3741.0,
|
283
|
+
10033.4,
|
284
284
|
1100.9,
|
285
|
-
|
286
|
-
1301.
|
285
|
+
1338.8,
|
286
|
+
1301.3]
|
287
287
|
if not np.allclose(dist[tabcol].tolist(), expected,
|
288
288
|
atol=0.1, rtol=0.0):
|
289
289
|
test_failure = True
|
@@ -297,17 +297,17 @@ def test_create_tables(cps_subsample):
|
|
297
297
|
expected = [0.0,
|
298
298
|
0.0,
|
299
299
|
-1.2,
|
300
|
-
-7.
|
301
|
-
3.
|
302
|
-
26.
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
335.
|
300
|
+
-7.1,
|
301
|
+
3.5,
|
302
|
+
26.7,
|
303
|
+
33.4,
|
304
|
+
55.2,
|
305
|
+
101.4,
|
306
|
+
335.2,
|
307
|
+
335.4,
|
308
308
|
65.6,
|
309
309
|
315.5,
|
310
|
-
|
310
|
+
1263.5]
|
311
311
|
if not np.allclose(dist[tabcol].values.astype('float'), expected,
|
312
312
|
atol=0.1, rtol=0.0):
|
313
313
|
test_failure = True
|