From 7ac5d6c7ceaca44bd641af4e481a0705695ef041 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Mon, 6 Jan 2025 13:22:26 -0500 Subject: [PATCH] Add test to test_records.py --- taxcalc/tests/test_records.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/taxcalc/tests/test_records.py b/taxcalc/tests/test_records.py index f2f42ede3..69a3ca0df 100644 --- a/taxcalc/tests/test_records.py +++ b/taxcalc/tests/test_records.py @@ -14,7 +14,7 @@ from taxcalc import GrowFactors, Policy, Records -def test_incorrect_records_instantiation(cps_subsample): +def test_incorrect_records_instantiation(cps_subsample, cps_fullsample): """Test docstring""" with pytest.raises(ValueError): _ = Records(data=[]) @@ -28,6 +28,11 @@ def test_incorrect_records_instantiation(cps_subsample): with pytest.raises(ValueError): _ = Records(data=cps_subsample, gfactors=None, weights=None, adjust_ratios=[]) + # test error raise when num of records is greater than num of weights + wghts_path = os.path.join(Records.CODE_PATH, Records.PUF_WEIGHTS_FILENAME) + puf_wghts = pd.read_csv(wghts_path) + with pytest.raises(ValueError): + _ = Records(data=cps_fullsample, weights=puf_wghts, start_year=2020) def test_correct_records_instantiation(cps_subsample):