Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ def tmd_weights_path():
@pytest.fixture(scope="session")
def tmd_growfactors_path():
return STORAGE_FOLDER / "output" / "tmd_growfactors.csv"


@pytest.fixture(scope="session")
def policy_growfactors_path():
return STORAGE_FOLDER / "output" / "growfactors.csv"
8 changes: 6 additions & 2 deletions tests/test_imputed_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_obbba_deduction_tax_benefits(
tmd_variables_path,
tmd_weights_path,
tmd_growfactors_path,
policy_growfactors_path,
):
"""
Estimate percent of tax-units affected by each new tax deduction and
Expand Down Expand Up @@ -123,7 +124,10 @@ def actual_results(rdf, bdf):
growfactors_path=tmd_growfactors_path,
)
# create baseline_sim Calculator object for simyear and get its output
pol = taxcalc.Policy()
policy_gf = taxcalc.GrowFactors(
growfactors_filename=str(policy_growfactors_path)
)
pol = taxcalc.Policy(gfactor=policy_gf)
pol.implement_reform(SOI_IITAX_SPEC)
baseline_sim = taxcalc.Calculator(policy=pol, records=recs)
baseline_sim.advance_to_year(simyear)
Expand All @@ -140,7 +144,7 @@ def actual_results(rdf, bdf):
tolerance_scale = 1.0
for ded, info in deductions.items():
# create reform Calculator object for simyear
reform_policy = taxcalc.Policy()
reform_policy = taxcalc.Policy(gfactor=policy_gf)
reform_policy.implement_reform(SOI_IITAX_SPEC)
reform_policy.implement_reform(info["reform_dict"])
reform_sim = taxcalc.Calculator(policy=reform_policy, records=recs)
Expand Down
11 changes: 9 additions & 2 deletions tests/test_revenue_levels_cbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,20 @@
reason="expected values are calibrated to TAXYEAR=2022",
)
def test_revenue_levels_cbo(
tests_folder, tmd_variables, tmd_weights_path, tmd_growfactors_path
tests_folder,
tmd_variables,
tmd_weights_path,
tmd_growfactors_path,
policy_growfactors_path,
):
epath = tests_folder / "expected_cbo_levels_2022_data.yaml"
with open(epath, "r", encoding="utf-8") as f:
exp = yaml.safe_load(f)

pol = taxcalc.Policy()
policy_gf = taxcalc.GrowFactors(
growfactors_filename=str(policy_growfactors_path)
)
pol = taxcalc.Policy(gfactor=policy_gf)
pol.implement_reform(SOI_IITAX_SPEC)
rec = taxcalc.Records(
data=tmd_variables,
Expand Down
10 changes: 8 additions & 2 deletions tests/test_soi_sanity_2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,20 @@ def _soi_target(soi_df, variable, count):


def test_soi_sanity_2022(
tmd_variables, tmd_weights_path, tmd_growfactors_path
tmd_variables,
tmd_weights_path,
tmd_growfactors_path,
policy_growfactors_path,
):
"""Five weighted 2022 totals from TMD within 1% of SOI targets."""
# Run TaxCalc at TAXYEAR to obtain c00100 (AGI) and iitax. e00200,
# e26270, and s006 are available directly on the input frame but
# using the post-calc_all arrays keeps one consistent source for
# all five aggregates.
pol = taxcalc.Policy()
policy_gf = taxcalc.GrowFactors(
growfactors_filename=str(policy_growfactors_path)
)
pol = taxcalc.Policy(gfactor=policy_gf)
pol.implement_reform(SOI_IITAX_SPEC)
recs = taxcalc.Records(
data=tmd_variables,
Expand Down
11 changes: 9 additions & 2 deletions tests/test_taxcalc_results_2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@
reason="expected values are calibrated to TAXYEAR=2022",
)
def test_taxcalc_results_2022(
tests_folder, tmd_variables, tmd_weights_path, tmd_growfactors_path
tests_folder,
tmd_variables,
tmd_weights_path,
tmd_growfactors_path,
policy_growfactors_path,
):
epath = tests_folder / "expected_taxcalc_results_2022.yaml"
with open(epath, "r", encoding="utf-8") as f:
expect = yaml.safe_load(f)

pol = taxcalc.Policy()
policy_gf = taxcalc.GrowFactors(
growfactors_filename=str(policy_growfactors_path)
)
pol = taxcalc.Policy(gfactor=policy_gf)
pol.implement_reform(SOI_IITAX_SPEC)
recs = taxcalc.Records(
data=tmd_variables,
Expand Down
Loading