Beispiel #1
0
def test_raises_ValueError_if_invalid_json_string_is_passed():
    with pytest.raises(ValueError):
        jsobj.create('invalid JSON string')
Beispiel #2
0
def test_nested_dicts_become_jsobjs(nested_data):
    obj = jsobj.create(nested_data)

    assert isinstance(obj.account, jsobj)
    assert isinstance(obj.account.number, jsobj)
Beispiel #3
0
def test_can_pass_initial_data_as_dict(simple_data):
    obj = jsobj.create(simple_data)

    assert obj == simple_data
Beispiel #4
0
def test_can_create_from_valid_json_string(simple_data):
    obj = jsobj.create(json_dumps(jsobj(simple_data)))

    assert obj == simple_data
Beispiel #5
0
def test_creates_empty_context_if_no_arguments_passed():
    obj = jsobj.create()
    assert obj == {}