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/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",
|
@@ -134,7 +134,7 @@
|
|
134
134
|
"15": {
|
135
135
|
"baseline": "2017_law.json",
|
136
136
|
"start_year": 2015,
|
137
|
-
"value": {"
|
137
|
+
"value": {"II_em_prt": 0.03},
|
138
138
|
"name": "Increase personal exemption phaseout rate by 1 pts",
|
139
139
|
"output_type": "iitax",
|
140
140
|
"compare_with": {}
|
@@ -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
|
@@ -16,7 +16,7 @@ from taxcalc import calcfunctions
|
|
16
16
|
|
17
17
|
class GetFuncDefs(ast.NodeVisitor):
|
18
18
|
"""
|
19
|
-
Return information about each function defined in
|
19
|
+
Return information about each function defined in calcfunctions.py file.
|
20
20
|
"""
|
21
21
|
def __init__(self):
|
22
22
|
"""
|
@@ -39,6 +39,8 @@ class GetFuncDefs(ast.NodeVisitor):
|
|
39
39
|
"""
|
40
40
|
visit the specified FunctionDef node
|
41
41
|
"""
|
42
|
+
if node.name == 'SchXYZ':
|
43
|
+
return # skipping SchXYZ function that has multiple returns
|
42
44
|
self.fname = node.name
|
43
45
|
self.fnames.append(self.fname)
|
44
46
|
self.fargs[self.fname] = []
|
@@ -68,6 +70,7 @@ class GetFuncDefs(ast.NodeVisitor):
|
|
68
70
|
self.generic_visit(node)
|
69
71
|
|
70
72
|
|
73
|
+
@pytest.mark.calc_and_used_vars
|
71
74
|
def test_calc_and_used_vars(tests_path):
|
72
75
|
"""
|
73
76
|
Runs two kinds of tests on variables used in the calcfunctions.py file:
|
@@ -92,8 +95,6 @@ def test_calc_and_used_vars(tests_path):
|
|
92
95
|
# .. create set of vars that are actually calculated in calcfunctions.py
|
93
96
|
all_cvars = set()
|
94
97
|
for fname in fnames:
|
95
|
-
if fname == 'BenefitSurtax':
|
96
|
-
continue # because BenefitSurtax is not really a function
|
97
98
|
all_cvars.update(set(cvars[fname]))
|
98
99
|
# .. add to all_cvars set variables calculated in Records class
|
99
100
|
all_cvars.update(set(['num', 'sep', 'exact']))
|
@@ -110,8 +111,7 @@ def test_calc_and_used_vars(tests_path):
|
|
110
111
|
found_error1 = True
|
111
112
|
msg1 += f'VAR NOT CALCULATED: {var}\n'
|
112
113
|
# Test (2):
|
113
|
-
faux_functions = ['EITCamount', '
|
114
|
-
'BenefitSurtax', 'BenefitLimitation']
|
114
|
+
faux_functions = ['EITCamount', 'SchXYZ', 'BenefitPrograms']
|
115
115
|
found_error2 = False
|
116
116
|
msg2 = 'calculated & returned variables are not function arguments\n'
|
117
117
|
for fname in fnames:
|
@@ -157,8 +157,6 @@ def test_function_args_usage(tests_path):
|
|
157
157
|
fname = match.group(1)
|
158
158
|
fargs = match.group(2).split(',') # list of function arguments
|
159
159
|
fbody = match.group(3)
|
160
|
-
if fname == 'Taxes':
|
161
|
-
continue # because Taxes has part of fbody in return statement
|
162
160
|
for farg in fargs:
|
163
161
|
arg = farg.strip()
|
164
162
|
if fbody.find(arg) < 0:
|
@@ -558,6 +556,7 @@ def test_EITC(test_tuple, expected_value, skip_jit):
|
|
558
556
|
|
559
557
|
# Parameter values for tests
|
560
558
|
PT_qbid_rt = 0.2
|
559
|
+
PT_qbid_limited = True
|
561
560
|
PT_qbid_taxinc_thd = [160700.0, 321400.0, 160725.0, 160700.0, 321400.0]
|
562
561
|
PT_qbid_taxinc_gap = [50000.0, 100000.0, 50000.0, 50000.0, 100000.0]
|
563
562
|
PT_qbid_w2_wages_rt = 0.5
|
@@ -579,6 +578,7 @@ e02100 = [0.00, 0.00, 0.00, 0.00]
|
|
579
578
|
e27200 = [0.00, 0.00, 0.00, 0.00]
|
580
579
|
e00650 = [5000.00, 8000.00, 3000.00, 9000.00]
|
581
580
|
c01000 = [7000.00, 4000.00, -3000.00, -3000.00]
|
581
|
+
auto_loan_interest_deduction = [0.00, 0.00, 0.00, 1000.00]
|
582
582
|
PT_SSTB_income = [0, 1, 1, 1]
|
583
583
|
PT_binc_w2_wages = [0.00, 0.00, 0.00, 0.00]
|
584
584
|
PT_ubia_property = [0.00, 0.00, 0.00, 0.00]
|
@@ -588,8 +588,9 @@ qbided = [0.0, 0.0, 0.0, 0.0] # unimportant for function
|
|
588
588
|
tuple0 = (
|
589
589
|
c00100[0], standard[0], c04470[0], c04600[0], MARS[0], e00900[0],
|
590
590
|
c03260[0], e26270[0],
|
591
|
-
e02100[0], e27200[0], e00650[0], c01000[0],
|
592
|
-
|
591
|
+
e02100[0], e27200[0], e00650[0], c01000[0],
|
592
|
+
auto_loan_interest_deduction[0], PT_SSTB_income[0],
|
593
|
+
PT_binc_w2_wages[0], PT_ubia_property[0], PT_qbid_rt, PT_qbid_limited,
|
593
594
|
PT_qbid_taxinc_thd, PT_qbid_taxinc_gap, PT_qbid_w2_wages_rt,
|
594
595
|
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt, c04800[0],
|
595
596
|
PT_qbid_ps, PT_qbid_prt, qbided[0])
|
@@ -597,8 +598,9 @@ expected0 = (490860.66, 0)
|
|
597
598
|
tuple1 = (
|
598
599
|
c00100[1], standard[1], c04470[1], c04600[1], MARS[1], e00900[1],
|
599
600
|
c03260[1], e26270[1],
|
600
|
-
e02100[1], e27200[1], e00650[1], c01000[1],
|
601
|
-
|
601
|
+
e02100[1], e27200[1], e00650[1], c01000[1],
|
602
|
+
auto_loan_interest_deduction[1], PT_SSTB_income[1],
|
603
|
+
PT_binc_w2_wages[1], PT_ubia_property[1], PT_qbid_rt, PT_qbid_limited,
|
602
604
|
PT_qbid_taxinc_thd, PT_qbid_taxinc_gap, PT_qbid_w2_wages_rt,
|
603
605
|
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt, c04800[1],
|
604
606
|
PT_qbid_ps, PT_qbid_prt, qbided[1])
|
@@ -606,8 +608,9 @@ expected1 = (284400.08, 4275.02)
|
|
606
608
|
tuple2 = (
|
607
609
|
c00100[2], standard[2], c04470[2], c04600[2], MARS[2], e00900[2],
|
608
610
|
c03260[2], e26270[2],
|
609
|
-
e02100[2], e27200[2], e00650[2], c01000[2],
|
610
|
-
|
611
|
+
e02100[2], e27200[2], e00650[2], c01000[2],
|
612
|
+
auto_loan_interest_deduction[2], PT_SSTB_income[2],
|
613
|
+
PT_binc_w2_wages[2], PT_ubia_property[2], PT_qbid_rt, PT_qbid_limited,
|
611
614
|
PT_qbid_taxinc_thd, PT_qbid_taxinc_gap, PT_qbid_w2_wages_rt,
|
612
615
|
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt, c04800[2],
|
613
616
|
PT_qbid_ps, PT_qbid_prt, qbided[2])
|
@@ -615,13 +618,13 @@ expected2 = (579300.00, 0)
|
|
615
618
|
tuple3 = (
|
616
619
|
c00100[3], standard[3], c04470[3], c04600[3], MARS[3], e00900[3],
|
617
620
|
c03260[3], e26270[3],
|
618
|
-
|
619
|
-
|
620
|
-
PT_binc_w2_wages[3], PT_ubia_property[3], PT_qbid_rt,
|
621
|
+
e02100[3], e27200[3], e00650[3], c01000[3],
|
622
|
+
auto_loan_interest_deduction[3], PT_SSTB_income[3],
|
623
|
+
PT_binc_w2_wages[3], PT_ubia_property[3], PT_qbid_rt, PT_qbid_limited,
|
621
624
|
PT_qbid_taxinc_thd, PT_qbid_taxinc_gap, PT_qbid_w2_wages_rt,
|
622
625
|
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt, c04800[3],
|
623
626
|
PT_qbid_ps, PT_qbid_prt, qbided[3])
|
624
|
-
expected3 = (
|
627
|
+
expected3 = (56500.00, 1200)
|
625
628
|
|
626
629
|
|
627
630
|
@pytest.mark.parametrize(
|
@@ -886,3 +889,77 @@ def test_AGI(test_tuple, expected_value, skip_jit):
|
|
886
889
|
test_value = calcfunctions.AGI(*test_tuple)
|
887
890
|
print('Returned from agi function: ', test_value)
|
888
891
|
assert np.allclose(test_value, expected_value)
|
892
|
+
|
893
|
+
|
894
|
+
# parameters for next test
|
895
|
+
e03150 = 0
|
896
|
+
e03210 = 0
|
897
|
+
c03260 = 0
|
898
|
+
e03270 = 0
|
899
|
+
e03300 = 0
|
900
|
+
e03400 = 0
|
901
|
+
e03500 = 0
|
902
|
+
e00800 = 0
|
903
|
+
e03220 = 0
|
904
|
+
e03230 = 0
|
905
|
+
e03240 = 0
|
906
|
+
e03290 = 0
|
907
|
+
care_deduction = 0
|
908
|
+
ALD_StudentLoan_hc = 0
|
909
|
+
ALD_SelfEmp_HealthIns_hc = 0
|
910
|
+
ALD_KEOGH_SEP_hc = 0
|
911
|
+
ALD_EarlyWithdraw_hc = 0
|
912
|
+
ALD_AlimonyPaid_hc = 0
|
913
|
+
ALD_AlimonyReceived_hc = 0
|
914
|
+
ALD_EducatorExpenses_hc = 0
|
915
|
+
ALD_HSADeduction_hc = 0
|
916
|
+
ALD_IRAContributions_hc = 0
|
917
|
+
ALD_DomesticProduction_hc = 0
|
918
|
+
ALD_Tuition_hc = 0
|
919
|
+
MARS = 1
|
920
|
+
earned = 200000
|
921
|
+
overtime_income = 13000
|
922
|
+
ALD_OvertimeIncome_hc = 0.
|
923
|
+
ALD_OvertimeIncome_c = [12500, 25000, 12500, 12500, 12500]
|
924
|
+
ALD_OvertimeIncome_ps = [150000, 300000, 150000, 150000, 150000]
|
925
|
+
ALD_OvertimeIncome_prt = 0.10
|
926
|
+
tip_income = 30000
|
927
|
+
ALD_TipIncome_hc = 0.
|
928
|
+
ALD_TipIncome_c = [25000, 25000, 25000, 25000, 25000]
|
929
|
+
ALD_TipIncome_ps = [150000, 300000, 150000, 150000, 150000]
|
930
|
+
ALD_TipIncome_prt = 0.10
|
931
|
+
c02900 = 0 # calculated in function
|
932
|
+
ALD_OvertimeIncome = 0 # calculated in function
|
933
|
+
ALD_TipIncome = 0 # calculated in function
|
934
|
+
|
935
|
+
tuple0 = (
|
936
|
+
e03150, e03210, c03260,
|
937
|
+
e03270, e03300, e03400, e03500, e00800,
|
938
|
+
e03220, e03230, e03240, e03290, care_deduction,
|
939
|
+
ALD_StudentLoan_hc, ALD_SelfEmp_HealthIns_hc, ALD_KEOGH_SEP_hc,
|
940
|
+
ALD_EarlyWithdraw_hc, ALD_AlimonyPaid_hc, ALD_AlimonyReceived_hc,
|
941
|
+
ALD_EducatorExpenses_hc, ALD_HSADeduction_hc, ALD_IRAContributions_hc,
|
942
|
+
ALD_DomesticProduction_hc, ALD_Tuition_hc,
|
943
|
+
MARS, earned,
|
944
|
+
overtime_income, ALD_OvertimeIncome_hc, ALD_OvertimeIncome_c,
|
945
|
+
ALD_OvertimeIncome_ps, ALD_OvertimeIncome_prt,
|
946
|
+
tip_income, ALD_TipIncome_hc, ALD_TipIncome_c,
|
947
|
+
ALD_TipIncome_ps, ALD_TipIncome_prt,
|
948
|
+
c02900, ALD_OvertimeIncome, ALD_TipIncome
|
949
|
+
)
|
950
|
+
ovr = 12500 - (200000 - 150000) * 0.10
|
951
|
+
tip = 25000 - (200000 - 150000) * 0.10
|
952
|
+
c02900 = 0 + ovr + tip
|
953
|
+
expected0 = (c02900, ovr, tip)
|
954
|
+
|
955
|
+
|
956
|
+
@pytest.mark.parametrize(
|
957
|
+
'test_tuple,expected_value', [(tuple0, expected0)]
|
958
|
+
)
|
959
|
+
def test_Adj(test_tuple, expected_value, skip_jit):
|
960
|
+
"""
|
961
|
+
Tests the Adj function ALD_OvertimeIncome and ALD_TipIncome code
|
962
|
+
"""
|
963
|
+
test_value = calcfunctions.Adj(*test_tuple)
|
964
|
+
print('Returned from Adj function: ', test_value)
|
965
|
+
assert np.allclose(test_value, expected_value)
|