def test_raises_ValueError_if_invalid_json_string_is_passed(): with pytest.raises(ValueError): jsobj.create('invalid JSON string')
def test_nested_dicts_become_jsobjs(nested_data): obj = jsobj.create(nested_data) assert isinstance(obj.account, jsobj) assert isinstance(obj.account.number, jsobj)
def test_can_pass_initial_data_as_dict(simple_data): obj = jsobj.create(simple_data) assert obj == simple_data
def test_can_create_from_valid_json_string(simple_data): obj = jsobj.create(json_dumps(jsobj(simple_data))) assert obj == simple_data
def test_creates_empty_context_if_no_arguments_passed(): obj = jsobj.create() assert obj == {}