def test_read_json_revision_foramts(params, is_paramtools): """ Check _read_json_revision for ParamTools and Tax-Calculator styled parameters. """ result = Parameters._read_json_revision(params, "consumption") assert is_paramtools_format(result) is is_paramtools if is_paramtools: assert result == json.loads(params)["consumption"]
def test_read_json_revision(good_revision): """ Check _read_json_revision logic. """ # pllint: disable=private-method with pytest.raises(TypeError): # error because first obj argument is neither None nor a string Parameters._read_json_revision(list(), '') with pytest.raises(ValueError): # error because second topkey argument must be a string Parameters._read_json_revision(good_revision, 999) with pytest.raises(ValueError): # error because second topkey argument is not in good_revision Parameters._read_json_revision(good_revision, 'unknown_topkey')
def test_read_json_revision(): """ Check _read_json_revision logic. """ good_revision = """ { "consumption": {"BEN_mcaid_value": {"2013": 0.9}} } """ # pllint: disable=private-method with pytest.raises(ValueError): # error because first obj argument is neither None nor a string Parameters._read_json_revision(list(), '') with pytest.raises(ValueError): # error because second topkey argument must be a string Parameters._read_json_revision(good_revision, 999) with pytest.raises(ValueError): # error because second topkey argument is not in good_revision Parameters._read_json_revision(good_revision, 'unknown_topkey')
def test_read_json_revision(): """ Check _read_json_revision logic. """ good_revision = """ { "consumption": {"BEN_mcaid_value": {"2013": 0.9}} } """ # pllint: disable=private-method with pytest.raises(ValueError): # error because first obj argument is neither None nor a string Parameters._read_json_revision(list(), '') with pytest.raises(ValueError): # error because second topkey argument must be a string Parameters._read_json_revision(good_revision, 999) with pytest.raises(ValueError): # error because second topkey argument is not in good_revision Parameters._read_json_revision(good_revision, 'unknown_topkey')