taxcalc 4.6.3__py3-none-any.whl → 5.0.0__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 +54 -459
- taxcalc/calculator.py +9 -7
- taxcalc/parameters.py +0 -3
- taxcalc/policy.py +37 -30
- taxcalc/policy_current_law.json +736 -4554
- taxcalc/records_variables.json +0 -40
- taxcalc/reforms/2017_law.json +1 -15
- 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 +36 -88
- taxcalc/tests/reforms_expect.csv +32 -35
- taxcalc/tests/test_calcfunctions.py +1 -1
- taxcalc/tests/test_calculator.py +9 -81
- taxcalc/tests/test_compatible_data.py +0 -6
- taxcalc/tests/test_parameters.py +4 -0
- taxcalc/tests/test_policy.py +4 -30
- 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.0.dist-info}/METADATA +1 -1
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/RECORD +31 -31
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/WHEEL +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/entry_points.txt +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/licenses/LICENSE +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/top_level.txt +0 -0
taxcalc/tests/reforms.json
CHANGED
@@ -49,8 +49,8 @@
|
|
49
49
|
"6": {
|
50
50
|
"baseline": "2017_law.json",
|
51
51
|
"start_year": 2015,
|
52
|
-
"value": {"
|
53
|
-
"
|
52
|
+
"value": {"SS_thd1": [0, 0, 0, 0, 0],
|
53
|
+
"SS_thd2": [0, 0, 0, 0, 0],
|
54
54
|
"SS_percentage1": 1,
|
55
55
|
"SS_percentage2": 1},
|
56
56
|
"name": "All OASDI benefits included in AGI",
|
@@ -259,16 +259,6 @@
|
|
259
259
|
},
|
260
260
|
|
261
261
|
"29": {
|
262
|
-
"baseline": "2017_law.json",
|
263
|
-
"start_year": 2015,
|
264
|
-
"value": {"ID_BenefitSurtax_crt": 0.06,
|
265
|
-
"ID_BenefitSurtax_trt": 1},
|
266
|
-
"name": "Limit tax value of itemded to 6% of AGI",
|
267
|
-
"output_type": "iitax",
|
268
|
-
"compare_with": {"Budget Options": [11, 9, 8, 7]}
|
269
|
-
},
|
270
|
-
|
271
|
-
"30": {
|
272
262
|
"baseline": "2017_law.json",
|
273
263
|
"start_year": 2015,
|
274
264
|
"value": {"CG_rt1": 0.02,
|
@@ -282,7 +272,7 @@
|
|
282
272
|
"compare_with": {}
|
283
273
|
},
|
284
274
|
|
285
|
-
"
|
275
|
+
"30": {
|
286
276
|
"baseline": "policy_current_law.json",
|
287
277
|
"start_year": 2016,
|
288
278
|
"value": {"ODC_c": 600},
|
@@ -291,7 +281,7 @@
|
|
291
281
|
"compare_with": {}
|
292
282
|
},
|
293
283
|
|
294
|
-
"
|
284
|
+
"31": {
|
295
285
|
"baseline": "2017_law.json",
|
296
286
|
"start_year": 2015,
|
297
287
|
"value": {"II_rt1": 0.11,
|
@@ -300,20 +290,13 @@
|
|
300
290
|
"II_rt4": 0.29,
|
301
291
|
"II_rt5": 0.34,
|
302
292
|
"II_rt6": 0.36,
|
303
|
-
"II_rt7": 0.406,
|
304
|
-
"PT_rt1": 0.11,
|
305
|
-
"PT_rt2": 0.16,
|
306
|
-
"PT_rt3": 0.26,
|
307
|
-
"PT_rt4": 0.29,
|
308
|
-
"PT_rt5": 0.34,
|
309
|
-
"PT_rt6": 0.36,
|
310
|
-
"PT_rt7": 0.406},
|
293
|
+
"II_rt7": 0.406},
|
311
294
|
"name": "Increase tax rate in each bracket by 1 pts",
|
312
295
|
"output_type": "iitax",
|
313
296
|
"compare_with": {"Budget Options": [56, 60, 65, 69]}
|
314
297
|
},
|
315
298
|
|
316
|
-
"
|
299
|
+
"32": {
|
317
300
|
"baseline": "2017_law.json",
|
318
301
|
"start_year": 2015,
|
319
302
|
"value": {"II_rt1": 0.10,
|
@@ -322,20 +305,13 @@
|
|
322
305
|
"II_rt4": 0.29,
|
323
306
|
"II_rt5": 0.34,
|
324
307
|
"II_rt6": 0.36,
|
325
|
-
"II_rt7": 0.406,
|
326
|
-
"PT_rt1": 0.10,
|
327
|
-
"PT_rt2": 0.15,
|
328
|
-
"PT_rt3": 0.25,
|
329
|
-
"PT_rt4": 0.29,
|
330
|
-
"PT_rt5": 0.34,
|
331
|
-
"PT_rt6": 0.36,
|
332
|
-
"PT_rt7": 0.406},
|
308
|
+
"II_rt7": 0.406},
|
333
309
|
"name": "Increase top four rates by 1 pts",
|
334
310
|
"output_type": "iitax",
|
335
311
|
"compare_with": {"Budget Options": [11, 12, 14, 15]}
|
336
312
|
},
|
337
313
|
|
338
|
-
"
|
314
|
+
"33": {
|
339
315
|
"baseline": "2017_law.json",
|
340
316
|
"start_year": 2015,
|
341
317
|
"value": {"II_rt1": 0.10,
|
@@ -344,20 +320,13 @@
|
|
344
320
|
"II_rt4": 0.28,
|
345
321
|
"II_rt5": 0.33,
|
346
322
|
"II_rt6": 0.36,
|
347
|
-
"II_rt7": 0.406,
|
348
|
-
"PT_rt1": 0.10,
|
349
|
-
"PT_rt2": 0.15,
|
350
|
-
"PT_rt3": 0.25,
|
351
|
-
"PT_rt4": 0.28,
|
352
|
-
"PT_rt5": 0.33,
|
353
|
-
"PT_rt6": 0.36,
|
354
|
-
"PT_rt7": 0.406},
|
323
|
+
"II_rt7": 0.406},
|
355
324
|
"name": "Increase top two rates by 1 pts",
|
356
325
|
"output_type": "iitax",
|
357
326
|
"compare_with": {"Budget Options": [7, 8, 9, 10]}
|
358
327
|
},
|
359
328
|
|
360
|
-
"
|
329
|
+
"34": {
|
361
330
|
"baseline": "2017_law.json",
|
362
331
|
"start_year": 2015,
|
363
332
|
"value": {"AMT_em": [54600, 84400, 42700, 54600, 84400]},
|
@@ -366,7 +335,7 @@
|
|
366
335
|
"compare_with": {}
|
367
336
|
},
|
368
337
|
|
369
|
-
"
|
338
|
+
"35": {
|
370
339
|
"baseline": "2017_law.json",
|
371
340
|
"start_year": 2015,
|
372
341
|
"value": {"AMT_em_ps": [129200, 168900, 89450, 129200, 168900]},
|
@@ -375,7 +344,7 @@
|
|
375
344
|
"compare_with": {}
|
376
345
|
},
|
377
346
|
|
378
|
-
"
|
347
|
+
"36": {
|
379
348
|
"baseline": "2017_law.json",
|
380
349
|
"start_year": 2015,
|
381
350
|
"value": {"AMT_prt": 0.27},
|
@@ -384,7 +353,7 @@
|
|
384
353
|
"compare_with": {}
|
385
354
|
},
|
386
355
|
|
387
|
-
"
|
356
|
+
"37": {
|
388
357
|
"baseline": "2017_law.json",
|
389
358
|
"start_year": 2015,
|
390
359
|
"value": {"AMT_rt1": 0.28},
|
@@ -393,7 +362,7 @@
|
|
393
362
|
"compare_with": {}
|
394
363
|
},
|
395
364
|
|
396
|
-
"
|
365
|
+
"38": {
|
397
366
|
"baseline": "2017_law.json",
|
398
367
|
"start_year": 2015,
|
399
368
|
"value": {"AMT_rt2": 0.04},
|
@@ -402,7 +371,7 @@
|
|
402
371
|
"compare_with": {}
|
403
372
|
},
|
404
373
|
|
405
|
-
"
|
374
|
+
"39": {
|
406
375
|
"baseline": "2017_law.json",
|
407
376
|
"start_year": 2015,
|
408
377
|
"value": {"AMT_brk1": 195400},
|
@@ -411,7 +380,7 @@
|
|
411
380
|
"compare_with": {}
|
412
381
|
},
|
413
382
|
|
414
|
-
"
|
383
|
+
"40": {
|
415
384
|
"baseline": "2017_law.json",
|
416
385
|
"start_year": 2015,
|
417
386
|
"value": {"CTC_c": 0, "ACTC_c": 0},
|
@@ -420,7 +389,7 @@
|
|
420
389
|
"compare_with": {"Tax Expenditure": [57.3, 57.0, 57.1, 56.8]}
|
421
390
|
},
|
422
391
|
|
423
|
-
"
|
392
|
+
"41": {
|
424
393
|
"baseline": "2017_law.json",
|
425
394
|
"start_year": 2015,
|
426
395
|
"value": {"CTC_prt": 0.06},
|
@@ -429,7 +398,7 @@
|
|
429
398
|
"compare_with": {}
|
430
399
|
},
|
431
400
|
|
432
|
-
"
|
401
|
+
"42": {
|
433
402
|
"baseline": "2017_law.json",
|
434
403
|
"start_year": 2015,
|
435
404
|
"value": {"CTC_ps": [76000, 111000, 56000, 76000, 76000]},
|
@@ -438,7 +407,7 @@
|
|
438
407
|
"compare_with": {}
|
439
408
|
},
|
440
409
|
|
441
|
-
"
|
410
|
+
"43": {
|
442
411
|
"baseline": "2017_law.json",
|
443
412
|
"start_year": 2015,
|
444
413
|
"value": {"EITC_rt": [0, 0, 0, 0]},
|
@@ -447,7 +416,7 @@
|
|
447
416
|
"compare_with": {"Tax Expenditure": [70.4, 71.1, 72.2, 69.9]}
|
448
417
|
},
|
449
418
|
|
450
|
-
"
|
419
|
+
"44": {
|
451
420
|
"baseline": "2017_law.json",
|
452
421
|
"start_year": 2015,
|
453
422
|
"value": {"EITC_prt": [0.0865, 0.1698, 0.2206, 0.2206]},
|
@@ -456,7 +425,7 @@
|
|
456
425
|
"compare_with": {}
|
457
426
|
},
|
458
427
|
|
459
|
-
"
|
428
|
+
"45": {
|
460
429
|
"baseline": "2017_law.json",
|
461
430
|
"start_year": 2015,
|
462
431
|
"value": {"EITC_ps": [9240, 19110, 19110, 19110]},
|
@@ -465,7 +434,7 @@
|
|
465
434
|
"compare_with": {}
|
466
435
|
},
|
467
436
|
|
468
|
-
"
|
437
|
+
"46": {
|
469
438
|
"baseline": "2017_law.json",
|
470
439
|
"start_year": 2015,
|
471
440
|
"value": {"EITC_c": [603, 3459, 5648, 6342]},
|
@@ -474,7 +443,7 @@
|
|
474
443
|
"compare_with": {}
|
475
444
|
},
|
476
445
|
|
477
|
-
"
|
446
|
+
"47": {
|
478
447
|
"baseline": "2017_law.json",
|
479
448
|
"start_year": 2015,
|
480
449
|
"value": {"ACTC_rt": 0.17},
|
@@ -483,7 +452,7 @@
|
|
483
452
|
"compare_with": {}
|
484
453
|
},
|
485
454
|
|
486
|
-
"
|
455
|
+
"48": {
|
487
456
|
"baseline": "2017_law.json",
|
488
457
|
"start_year": 2015,
|
489
458
|
"value": {"ACTC_ChildNum": 2},
|
@@ -492,7 +461,7 @@
|
|
492
461
|
"compare_with": {}
|
493
462
|
},
|
494
463
|
|
495
|
-
"
|
464
|
+
"49": {
|
496
465
|
"baseline": "2017_law.json",
|
497
466
|
"start_year": 2015,
|
498
467
|
"value": {"NIIT_rt": 0},
|
@@ -501,7 +470,7 @@
|
|
501
470
|
"compare_with": {"Tax Expenditure": [-32.6, -34.7, -36.6, -38.9]}
|
502
471
|
},
|
503
472
|
|
504
|
-
"
|
473
|
+
"50": {
|
505
474
|
"baseline": "2017_law.json",
|
506
475
|
"start_year": 2015,
|
507
476
|
"value": {"NIIT_thd": [210000, 260000, 135000, 210000, 260000]},
|
@@ -510,7 +479,7 @@
|
|
510
479
|
"compare_with": {}
|
511
480
|
},
|
512
481
|
|
513
|
-
"
|
482
|
+
"51": {
|
514
483
|
"baseline": "2017_law.json",
|
515
484
|
"start_year": 2015,
|
516
485
|
"value": {"II_credit": [1000, 1000, 1000, 1000, 1000]},
|
@@ -519,7 +488,7 @@
|
|
519
488
|
"compare_with": {}
|
520
489
|
},
|
521
490
|
|
522
|
-
"
|
491
|
+
"52": {
|
523
492
|
"baseline": "2017_law.json",
|
524
493
|
"start_year": 2015,
|
525
494
|
"value": {"II_credit": [1000, 1000, 1000, 1000, 1000],
|
@@ -530,7 +499,7 @@
|
|
530
499
|
"compare_with": {}
|
531
500
|
},
|
532
501
|
|
533
|
-
"
|
502
|
+
"53": {
|
534
503
|
"baseline": "2017_law.json",
|
535
504
|
"start_year": 2017,
|
536
505
|
"value": {"FST_AGI_trt": 0.3,
|
@@ -542,7 +511,7 @@
|
|
542
511
|
"static", "estimate"]}
|
543
512
|
},
|
544
513
|
|
545
|
-
"
|
514
|
+
"54": {
|
546
515
|
"baseline": "policy_current_law.json",
|
547
516
|
"start_year": 2017,
|
548
517
|
"value": {"parameter_indexing_CPI_offset": 0},
|
@@ -551,28 +520,7 @@
|
|
551
520
|
"compare_with": {}
|
552
521
|
},
|
553
522
|
|
554
|
-
"
|
555
|
-
"baseline": "2017_law.json",
|
556
|
-
"start_year": 2017,
|
557
|
-
"value": {"PT_rt7": 0.35,
|
558
|
-
"PT_EligibleRate_active": 0.7},
|
559
|
-
"name": "Top pass through rate at 0.35 AND 70% of active business inc eligible for lower rate",
|
560
|
-
"output_type": "iitax",
|
561
|
-
"compare_with": {}
|
562
|
-
},
|
563
|
-
|
564
|
-
"57": {
|
565
|
-
"baseline": "2017_law.json",
|
566
|
-
"start_year": 2017,
|
567
|
-
"value": {"PT_wages_active_income": true,
|
568
|
-
"PT_EligibleRate_active": 0.7,
|
569
|
-
"PT_rt7": 0.35},
|
570
|
-
"name": "Top pass through rate at 0.35 AND 70% of active business inc eligible for lower rate AND wages included in (positive) active business income eligible for PT rates",
|
571
|
-
"output_type": "iitax",
|
572
|
-
"compare_with": {}
|
573
|
-
},
|
574
|
-
|
575
|
-
"58": {
|
523
|
+
"55": {
|
576
524
|
"baseline": "2017_law.json",
|
577
525
|
"start_year": 2017,
|
578
526
|
"value": {"CTC_new_c": 1000,
|
@@ -584,7 +532,7 @@
|
|
584
532
|
"compare_with": {}
|
585
533
|
},
|
586
534
|
|
587
|
-
"
|
535
|
+
"56": {
|
588
536
|
"baseline": "2017_law.json",
|
589
537
|
"start_year": 2017,
|
590
538
|
"value": {"CTC_new_c": 1000,
|
@@ -597,7 +545,7 @@
|
|
597
545
|
"compare_with": {}
|
598
546
|
},
|
599
547
|
|
600
|
-
"
|
548
|
+
"57": {
|
601
549
|
"baseline": "2017_law.json",
|
602
550
|
"start_year": 2017,
|
603
551
|
"value": {"ID_Charity_hc": 1,
|
@@ -608,7 +556,7 @@
|
|
608
556
|
"compare_with": {}
|
609
557
|
},
|
610
558
|
|
611
|
-
"
|
559
|
+
"58": {
|
612
560
|
"baseline": "2017_law.json",
|
613
561
|
"start_year": 2019,
|
614
562
|
"value": {"EITC_basic_frac": 0.5},
|
@@ -617,7 +565,7 @@
|
|
617
565
|
"compare_with": {}
|
618
566
|
},
|
619
567
|
|
620
|
-
"
|
568
|
+
"59": {
|
621
569
|
"baseline": "policy_current_law.json",
|
622
570
|
"start_year": 2019,
|
623
571
|
"value": {"EITC_indiv": true},
|
@@ -626,7 +574,7 @@
|
|
626
574
|
"compare_with": {}
|
627
575
|
},
|
628
576
|
|
629
|
-
"
|
577
|
+
"60": {
|
630
578
|
"baseline": "policy_current_law.json",
|
631
579
|
"start_year": 2019,
|
632
580
|
"value": {"RPTC_rt": 0.062,
|
taxcalc/tests/reforms_expect.csv
CHANGED
@@ -27,38 +27,35 @@ rid,res1,res2,res3,res4
|
|
27
27
|
26,0.1,0.1,0.1,0.1
|
28
28
|
27,0.1,0.1,0.1,0.1
|
29
29
|
28,3.8,3.7,4.2,4.6
|
30
|
-
29,
|
31
|
-
30
|
32
|
-
31
|
33
|
-
32,
|
34
|
-
33,
|
35
|
-
34
|
36
|
-
35,-
|
37
|
-
36
|
38
|
-
37,
|
39
|
-
38,
|
40
|
-
39
|
41
|
-
40
|
42
|
-
41,
|
43
|
-
42
|
44
|
-
43
|
45
|
-
44,
|
46
|
-
45
|
47
|
-
46,-2.1,-
|
48
|
-
47,-
|
49
|
-
48,-0.
|
50
|
-
49,-
|
51
|
-
50,-
|
52
|
-
51,-
|
53
|
-
52,-
|
54
|
-
53
|
55
|
-
54,
|
56
|
-
55
|
57
|
-
56,-
|
58
|
-
57,-
|
59
|
-
58,-
|
60
|
-
59,-
|
61
|
-
60,-
|
62
|
-
61,-17.4,-18.0,-24.3,-20.0
|
63
|
-
62,-12.7,-13.0,-23.4,-13.8
|
64
|
-
63,-46.9,-48.1,-49.2,-52.0
|
30
|
+
29,14.7,13.3,17.2,18.6
|
31
|
+
30,-6.6,-6.4,-1.6,-1.6
|
32
|
+
31,57.4,57.9,61.8,65.4
|
33
|
+
32,12.0,11.5,13.3,14.4
|
34
|
+
33,7.5,7.1,8.3,9.0
|
35
|
+
34,-1.2,-0.9,-1.5,-1.6
|
36
|
+
35,-2.9,-2.8,-3.5,-3.7
|
37
|
+
36,3.1,3.2,3.6,3.9
|
38
|
+
37,29.8,30.9,34.1,36.2
|
39
|
+
38,9.2,9.6,10.5,11.3
|
40
|
+
39,-0.6,-0.5,-0.7,-0.7
|
41
|
+
40,54.0,52.3,51.2,50.2
|
42
|
+
41,0.5,0.6,0.6,0.6
|
43
|
+
42,-0.2,-0.2,-0.2,-0.2
|
44
|
+
43,70.6,68.8,67.9,69.4
|
45
|
+
44,1.2,1.1,1.1,1.2
|
46
|
+
45,-2.1,-2.0,-2.2,-2.2
|
47
|
+
46,-2.1,-1.8,-2.1,-2.2
|
48
|
+
47,-0.8,-0.8,-0.8,-0.7
|
49
|
+
48,-0.0,-0.0,-0.0,-0.0
|
50
|
+
49,-26.5,-23.7,-31.1,-33.9
|
51
|
+
50,-0.3,-0.3,-0.5,-0.5
|
52
|
+
51,-187.0,-187.5,-193.6,-201.6
|
53
|
+
52,-130.0,-129.3,-132.7,-137.7
|
54
|
+
53,30.7,33.2,31.4,41.0
|
55
|
+
54,0.0,0.0,0.0,0.0
|
56
|
+
55,-66.9,-66.9,-67.0,-67.1
|
57
|
+
56,-67.3,-67.2,-67.3,-67.4
|
58
|
+
57,-1.0,-0.6,-0.8,-1.7
|
59
|
+
58,-17.4,-18.0,-24.3,-20.0
|
60
|
+
59,-12.7,-13.0,-23.4,-13.8
|
61
|
+
60,-46.9,-48.1,-49.2,-52.0
|
@@ -111,7 +111,7 @@ def test_calc_and_used_vars(tests_path):
|
|
111
111
|
msg1 += f'VAR NOT CALCULATED: {var}\n'
|
112
112
|
# Test (2):
|
113
113
|
faux_functions = ['EITCamount', 'ComputeBenefit', 'BenefitPrograms',
|
114
|
-
'BenefitSurtax', 'BenefitLimitation']
|
114
|
+
'BenefitSurtax', 'BenefitLimitation', 'SchXYZ']
|
115
115
|
found_error2 = False
|
116
116
|
msg2 = 'calculated & returned variables are not function arguments\n'
|
117
117
|
for fname in fnames:
|
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__()
|
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,
|
@@ -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.
|