def test_load_value(): d = Database() o1 = d.create_object() o2 = d.create_object() data = dict( names=['hello', 'world'], objects=[ ObjectReference(o1.id), ObjectReference(o2.id) ], age=29 ) value = d.load_value(data) assert value == dict( names=['hello', 'world'], objects=[o1, o2], age=29 )
def test_load_value_object_class(): d = Database(object_class=CustomObject) o = d.create_object() assert isinstance(o, CustomObject) value = d.load_value(ObjectReference(o.id)) assert value is o