From f480d44bcfa98e0cae47ba9583197ddf38aedf0f Mon Sep 17 00:00:00 2001 From: Peter-Metz Date: Mon, 14 Sep 2020 09:42:34 -0400 Subject: [PATCH 1/4] remove extraneous line that created calc objects --- taxcrunch/multi_cruncher.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/taxcrunch/multi_cruncher.py b/taxcrunch/multi_cruncher.py index a4f1003..7e8a44b 100644 --- a/taxcrunch/multi_cruncher.py +++ b/taxcrunch/multi_cruncher.py @@ -46,7 +46,6 @@ class instance: Batch def __init__(self, path): self.path = path self.invar, self.invar_marg, self.rows = self.read_input() - self.mtr = self.calc_mtr(reform_file=None) self.TC_VARS = [ "RECID", @@ -180,6 +179,7 @@ def create_table( adjust_ratios=None, ) + # if tc_vars and tc_labels are not specified, defaults are used if tc_vars is None: tc_vars = self.TC_VARS if tc_labels is None: @@ -188,6 +188,7 @@ def create_table( assert len(tc_vars) > 0 assert len(tc_vars) == len(tc_labels) + # if no reform file is passed, table will show current law values if reform_file is None: pol = tc.Policy() assert be_sub == be_inc == be_cg == 0 @@ -195,6 +196,7 @@ def create_table( calc.advance_to_year(year) calc.calc_all() calcs = calc.dataframe(tc_vars) + # if a reform file is passed, table will show reform values else: pol = self.get_pol(reform_file) calc = tc.Calculator(policy=pol, records=recs) @@ -204,6 +206,7 @@ def create_table( _, df2br = br.response(calc_base, calc, response_elasticities, dump=True) calcs = df2br[tc_vars] + # if include_mtr is True, the tables includes three columns with MTRs if include_mtr: mtr = self.calc_mtr(reform_file) mtr_df = pd.DataFrame(data=mtr).transpose() From 523b9cb3b29a4ce61766b4fbc0c324c5e81dc851 Mon Sep 17 00:00:00 2001 From: Peter-Metz Date: Mon, 14 Sep 2020 09:42:57 -0400 Subject: [PATCH 2/4] add python 3.8 to travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index df41ac1..db84b92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ language: python python: - "3.6" - "3.7" + - "3.8" before_install: - "pip install -U pip" From fbdbbd7b4ef92fadca5b964c48bfa55294f3889c Mon Sep 17 00:00:00 2001 From: Peter-Metz Date: Mon, 14 Sep 2020 09:43:12 -0400 Subject: [PATCH 3/4] add test for mtr cols --- taxcrunch/tests/test_multi_cruncher.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/taxcrunch/tests/test_multi_cruncher.py b/taxcrunch/tests/test_multi_cruncher.py index 4503581..b49de7f 100644 --- a/taxcrunch/tests/test_multi_cruncher.py +++ b/taxcrunch/tests/test_multi_cruncher.py @@ -104,6 +104,16 @@ def test_custom_output_cols(crunch=b): b.create_table(tc_vars=["fake_var1", "fake_var2"], tc_labels=custom_labels) +def test_mtr_cols(crunch=b): + + mtr_cols = ["Payroll Tax MTR", "Income Tax MTR", "Combined MTR"] + table = b.create_table() + assert set(mtr_cols).issubset(table.columns) + + table_no_mtr = b.create_table(include_mtr=False) + assert set(mtr_cols).issubset(table_no_mtr.columns) is False + + def test_qbid_params(): """ Adpots a test from Tax-Calculator that checks QBID calculations against From bcbf242f4b242435bd40cc272d7b0d953d42efd6 Mon Sep 17 00:00:00 2001 From: Peter-Metz Date: Mon, 14 Sep 2020 10:05:12 -0400 Subject: [PATCH 4/4] bump to 0.4.3 --- taxcrunch/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taxcrunch/__init__.py b/taxcrunch/__init__.py index 98a5c18..cebed55 100644 --- a/taxcrunch/__init__.py +++ b/taxcrunch/__init__.py @@ -2,4 +2,4 @@ from taxcrunch.multi_cruncher import * name = "taxcrunch" -__version__ = "0.4.2" +__version__ = "0.4.3"