-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2756 from martinholmer/add-tmd-test
Add test_tmdcsv.py pytest file
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
Tests of Tax-Calculator using tmd.csv input. | ||
Note that the tmd.csv file that is required to run this program has | ||
been constructed in the PSLmodels tax-microdata repository using the | ||
2015 IRS SOI PUF file and recent Census CPS data. If you have | ||
acquired from IRS the 2015 SOI PUF file and want to execute this program, | ||
contact the Tax-Calculator development team to discuss your options. | ||
Read Tax-Calculator/TESTING.md for details. | ||
""" | ||
# CODING-STYLE CHECKS: | ||
# pycodestyle test_tmdcsv.py | ||
# pylint --disable=locally-disabled test_tmdcsv.py | ||
|
||
import pytest | ||
# pylint: disable=import-error | ||
from taxcalc import Policy, Records, Calculator | ||
|
||
|
||
@pytest.mark.requires_tmdcsv | ||
def test_tmd_input(tmd_fullsample): | ||
""" | ||
Test Tax-Calculator using full-sample tmd.csv file. | ||
""" | ||
taxyear = 2022 | ||
# create a Policy object with current-law policy parameters | ||
pol = Policy() | ||
# create a Records object containing all tmd.csv input records | ||
recs = Records.tmd_constructor(data=tmd_fullsample) | ||
# create a Calculator object using current-law policy and tmd records | ||
calc = Calculator(policy=pol, records=recs) | ||
calc.advance_to_year(taxyear) | ||
calc.calc_all() | ||
assert calc.data_year == Records.TMDCSV_YEAR | ||
assert calc.current_year == taxyear | ||
inctax = calc.weighted_total('iitax') | ||
assert inctax > 0 |