本文整理汇总了Python中taxcalc.Calculator.read_json_reform_file方法的典型用法代码示例。如果您正苦于以下问题:Python Calculator.read_json_reform_file方法的具体用法?Python Calculator.read_json_reform_file怎么用?Python Calculator.read_json_reform_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taxcalc.Calculator
的用法示例。
在下文中一共展示了Calculator.read_json_reform_file方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_read_json_reform_file_and_implement_reform
# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import read_json_reform_file [as 别名]
def test_read_json_reform_file_and_implement_reform(reform_file, set_year):
"""
Test reading and translation of reform file into a reform dictionary
that is then used to call implement_reform method.
NOTE: implement_reform called when policy.current_year == policy.start_year
"""
reform, rb, rg, rc = Calculator.read_json_reform_file(reform_file.name)
policy = Policy()
if set_year:
policy.set_year(2015)
policy.implement_reform(reform)
syr = policy.start_year
amt_brk1 = policy._AMT_brk1
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 = policy._II_em
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 = policy._AMT_em
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]
add4aged = policy._ID_Medical_frt_add4aged
assert add4aged[2015 - syr] == -0.025
assert add4aged[2016 - syr] == -0.025
assert add4aged[2017 - syr] == 0.0
assert add4aged[2022 - syr] == 0.0
示例2: test_prohibit_param_code
# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import read_json_reform_file [as 别名]
def test_prohibit_param_code(reform_file):
Policy.PROHIBIT_PARAM_CODE = True
with pytest.raises(ValueError):
Calculator.read_json_reform_file(reform_file.name)
Policy.PROHIBIT_PARAM_CODE = False
示例3: test_read_bad_json_reform_file
# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import read_json_reform_file [as 别名]
def test_read_bad_json_reform_file(bad1reformfile, bad2reformfile):
with pytest.raises(ValueError):
Calculator.read_json_reform_file(bad1reformfile.name)
with pytest.raises(ValueError):
Calculator.read_json_reform_file(bad2reformfile.name)