本文整理汇总了Python中taxcalc.Calculator.read_json_assumptions方法的典型用法代码示例。如果您正苦于以下问题:Python Calculator.read_json_assumptions方法的具体用法?Python Calculator.read_json_assumptions怎么用?Python Calculator.read_json_assumptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taxcalc.Calculator
的用法示例。
在下文中一共展示了Calculator.read_json_assumptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_read_json_assumptions
# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import read_json_assumptions [as 别名]
def test_read_json_assumptions(assumption_file):
"""
Test Calculator.read_json_assumptions() function.
"""
assert isinstance(Calculator.read_json_assumptions(None), dict)
with pytest.raises(ValueError):
Calculator.read_json_assumptions(list())
with pytest.raises(urllib.request.URLError):
Calculator.read_json_assumptions('http://unknown-url')
assump_filename = assumption_file.name
file_dict = Calculator.read_json_assumptions(assump_filename)
assert isinstance(file_dict, dict)
text_dict = Calculator.read_json_assumptions(ASSUMPTION_FILE_CONTENT)
assert isinstance(text_dict, dict)
assert text_dict == file_dict