def test_2(input_file, # pylint: disable=redefined-outer-name reform_file): # pylint: disable=redefined-outer-name """ Test SimpleTaxIO instantiation with a policy reform from JSON file. """ simtax = SimpleTaxIO(input_filename=input_file.name, reform=reform_file.name, exact_calculations=False, emulate_taxsim_2441_logic=False, output_records=False) assert simtax.number_input_lines() == NUM_INPUT_LINES # check that reform was implemented as specified above in REFORM_CONTENTS syr = simtax.start_year() amt_brk1 = simtax._policy._AMT_brk1 # pylint: disable=protected-access assert amt_brk1[2015 - syr] == 200000 assert amt_brk1[2016 - syr] > 200000 assert amt_brk1[2017 - syr] == 300000 assert amt_brk1[2018 - syr] > 300000 ii_em = simtax._policy._II_em # pylint: disable=protected-access assert ii_em[2016 - syr] == 6000 assert ii_em[2017 - syr] == 6000 assert ii_em[2018 - syr] == 7500 assert ii_em[2019 - syr] > 7500 assert ii_em[2020 - syr] == 9000 assert ii_em[2021 - syr] > 9000 amt_em = simtax._policy._AMT_em # pylint: disable=protected-access assert amt_em[2016 - syr, 0] > amt_em[2015 - syr, 0] assert amt_em[2017 - syr, 0] > amt_em[2016 - syr, 0] assert amt_em[2018 - syr, 0] == amt_em[2017 - syr, 0] assert amt_em[2019 - syr, 0] == amt_em[2017 - syr, 0] assert amt_em[2020 - syr, 0] == amt_em[2017 - syr, 0] assert amt_em[2021 - syr, 0] > amt_em[2020 - syr, 0] assert amt_em[2022 - syr, 0] > amt_em[2021 - syr, 0]
def test_2(input_file, # pylint: disable=redefined-outer-name reform_file): # pylint: disable=redefined-outer-name """ Test SimpleTaxIO instantiation with a policy reform from JSON file. """ simtax = SimpleTaxIO(input_filename=input_file.name, reform=reform_file.name, exact_calculations=False, emulate_taxsim_2441_logic=False, output_records=False) assert simtax.number_input_lines() == NUM_INPUT_LINES # check that reform was implemented as specified above in REFORM_CONTENTS syr = simtax.start_year() amt_tthd = simtax._policy._AMT_tthd # pylint: disable=protected-access assert amt_tthd[2015 - syr] == 200000 assert amt_tthd[2016 - syr] > 200000 assert amt_tthd[2017 - syr] == 300000 assert amt_tthd[2018 - syr] > 300000 ii_em = simtax._policy._II_em # pylint: disable=protected-access assert ii_em[2016 - syr] == 6000 assert ii_em[2017 - syr] == 6000 assert ii_em[2018 - syr] == 7500 assert ii_em[2019 - syr] > 7500 assert ii_em[2020 - syr] == 9000 assert ii_em[2021 - syr] > 9000 amt_em = simtax._policy._AMT_em # pylint: disable=protected-access assert amt_em[2016 - syr, 0] > amt_em[2015 - syr, 0] assert amt_em[2017 - syr, 0] > amt_em[2016 - syr, 0] assert amt_em[2018 - syr, 0] == amt_em[2017 - syr, 0] assert amt_em[2019 - syr, 0] == amt_em[2017 - syr, 0] assert amt_em[2020 - syr, 0] == amt_em[2017 - syr, 0] assert amt_em[2021 - syr, 0] > amt_em[2020 - syr, 0] assert amt_em[2022 - syr, 0] > amt_em[2021 - syr, 0]
def test_1(input_file): # pylint: disable=redefined-outer-name """ Test SimpleTaxIO constructor with no policy reform. """ SimpleTaxIO.show_iovar_definitions() simtax = SimpleTaxIO(input_filename=input_file.name, reform=None, emulate_taxsim_2441_logic=False) assert simtax.number_input_lines() == NUM_INPUT_LINES
def test_3(input_file): # pylint: disable=redefined-outer-name """ Test SimpleTaxIO calculate method with a policy reform from dictionary. """ policy_reform = { 2016: {'_SS_Earnings_c': [300000]}, 2018: {'_SS_Earnings_c': [500000]}, 2020: {'_SS_Earnings_c': [700000]} } simtax = SimpleTaxIO(input_filename=input_file.name, reform=policy_reform, emulate_taxsim_2441_logic=False) simtax.calculate() assert simtax.number_input_lines() == NUM_INPUT_LINES
def test_3(input_file): # pylint: disable=redefined-outer-name """ Test SimpleTaxIO calculate method with a policy reform from dictionary. """ policy_reform = { 2016: {'_SS_Earnings_c': [300000]}, 2018: {'_SS_Earnings_c': [500000]}, 2020: {'_SS_Earnings_c': [700000]} } simtax = SimpleTaxIO(input_filename=input_file.name, reform=policy_reform, emulate_taxsim_2441_logic=False, output_records=False) simtax.calculate() assert simtax.number_input_lines() == NUM_INPUT_LINES
def test_1(input_file): # pylint: disable=redefined-outer-name """ Test SimpleTaxIO instantiation with no policy reform. """ SimpleTaxIO.show_iovar_definitions() simtax = SimpleTaxIO(input_filename=input_file.name, reform=None, exact_calculations=False, emulate_taxsim_2441_logic=False, output_records=False) assert simtax.number_input_lines() == NUM_INPUT_LINES # test extracting of weight and debugging variables crecs = simtax._calc.records # pylint: disable=protected-access SimpleTaxIO.DVAR_NAMES = ['f2441'] # pylint: disable=unused-variable ovar = SimpleTaxIO.extract_output(crecs, 0, exact=True, extract_weight=True) SimpleTaxIO.DVAR_NAMES = ['badvar'] with pytest.raises(ValueError): ovar = SimpleTaxIO.extract_output(crecs, 0) SimpleTaxIO.DVAR_NAMES = []
def test_1(input_file): """ Test SimpleTaxIO instantiation with no policy reform. """ SimpleTaxIO.show_iovar_definitions() simtax = SimpleTaxIO(input_filename=input_file.name, reform=None, exact_calculations=False, emulate_taxsim_2441_logic=False, output_records=False) assert simtax.number_input_lines() == NUM_INPUT_LINES # test extracting of weight and debugging variables SimpleTaxIO.DVAR_NAMES = ['f2441'] ovar = SimpleTaxIO.extract_output(simtax.calc, 0, exact=True, extract_weight=True) assert ovar SimpleTaxIO.DVAR_NAMES = ['badvar'] with pytest.raises(AttributeError): ovar = SimpleTaxIO.extract_output(simtax.calc, 0) SimpleTaxIO.DVAR_NAMES = []