diff --git a/tests/conftest.py b/tests/conftest.py index 6f54518b..80d5cdce 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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" diff --git a/tests/test_imputed_variables.py b/tests/test_imputed_variables.py index 690c066c..d0800c90 100644 --- a/tests/test_imputed_variables.py +++ b/tests/test_imputed_variables.py @@ -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 @@ -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) @@ -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) diff --git a/tests/test_revenue_levels_cbo.py b/tests/test_revenue_levels_cbo.py index a9886018..dc253798 100644 --- a/tests/test_revenue_levels_cbo.py +++ b/tests/test_revenue_levels_cbo.py @@ -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, diff --git a/tests/test_soi_sanity_2022.py b/tests/test_soi_sanity_2022.py index d076c7a2..1c6f1a96 100644 --- a/tests/test_soi_sanity_2022.py +++ b/tests/test_soi_sanity_2022.py @@ -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, diff --git a/tests/test_taxcalc_results_2022.py b/tests/test_taxcalc_results_2022.py index d85c7419..58057aba 100644 --- a/tests/test_taxcalc_results_2022.py +++ b/tests/test_taxcalc_results_2022.py @@ -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,