Added concepts with the same key handling

This commit is contained in:
2019-11-18 17:02:02 +01:00
parent 7fa509555d
commit cb6be9fec7
15 changed files with 255 additions and 43 deletions
+17
View File
@@ -1316,3 +1316,20 @@ def test_i_can_save_and_load_object_ref_with_history():
state = sdp.load_state(sdp.get_snapshot())
assert state.data == {"entry": {
"my_key": '##REF##:e6bf5b56428cfce0f08c94f2c3625dc3b3a8180d7229eaa9f8aa967fb16e5256'}}
def test_i_can_add_obj_with_same_key_and_get_them_back():
sdp = SheerkaDataProvider(".sheerka")
obj1 = ObjDumpJson("key", "value1")
obj2 = ObjDumpJson("key", "value2")
sdp.serializer.register(ObjectSerializer(core.utils.get_full_qualified_name(obj1)))
entry1, key1 = sdp.add(evt_digest, "entry", obj1, use_ref=True)
entry2, key2 = sdp.add(evt_digest, "entry", obj2, use_ref=True)
loaded = sdp.get_safe(entry1, key1)
assert len(loaded) == 2
assert loaded[0] == obj1
assert loaded[1] == obj2