本文整理汇总了Python中taxcalc.Calculator._read_json_econ_assump_text方法的典型用法代码示例。如果您正苦于以下问题:Python Calculator._read_json_econ_assump_text方法的具体用法?Python Calculator._read_json_econ_assump_text怎么用?Python Calculator._read_json_econ_assump_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taxcalc.Calculator
的用法示例。
在下文中一共展示了Calculator._read_json_econ_assump_text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_response_json
# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import _read_json_econ_assump_text [as 别名]
def test_response_json(tests_path):
"""
Check that each JSON file can be converted into dictionaries that
can be used to construct objects needed for a Calculator object.
"""
# pylint: disable=too-many-locals
responses_path = os.path.join(tests_path, '..', 'responses', '*.json')
for jpf in glob.glob(responses_path):
# read contents of jpf (JSON parameter filename)
jfile = open(jpf, 'r')
jpf_text = jfile.read()
# check that jpf_text can be used to construct objects
response_file = ('"consumption"' in jpf_text and
'"growdiff_baseline"' in jpf_text and
'"growdiff_response"' in jpf_text)
if response_file:
# pylint: disable=protected-access
(con, gdiff_base,
gdiff_resp) = Calculator._read_json_econ_assump_text(jpf_text)
cons = Consumption()
cons.update_consumption(con)
growdiff_baseline = GrowDiff()
growdiff_baseline.update_growdiff(gdiff_base)
growdiff_response = GrowDiff()
growdiff_response.update_growdiff(gdiff_resp)
else: # jpf_text is not a valid JSON response assumption file
print('test-failing-filename: ' +
jpf)
assert False