Skip to content
Snippets Groups Projects
Commit 593a3acb authored by I. Nüske's avatar I. Nüske
Browse files

BUG: Only use name as key in compare_entities diff if names match

parent c8b0728a
No related branches found
No related tags found
2 merge requests!175BUG: Request responses without the "Set-Cookie" header no longer overwrite the...,!165Compare_entities diff uses id instead of name where needed
Pipeline #58565 passed
......@@ -379,7 +379,8 @@ def compare_entities(entity0: Optional[Entity] = None,
# compare properties
for prop in entity0.properties:
key = prop.name if prop.name is not None else prop.id # ToDo: Would making id default break anything?
# ToDo: Would making id default break anything?
key = prop.name if prop.name is not None else prop.id
matching = entity1.properties.filter(prop)
if len(matching) == 0:
# entity1 has prop, entity0 does not
......@@ -387,7 +388,7 @@ def compare_entities(entity0: Optional[Entity] = None,
elif len(matching) == 1:
# It's possible that prop has name and id, but match only has id
key = prop.name if (prop.name is not None and
matching[0].name is not None) else prop.id
matching[0].name == prop.name) else prop.id
diff[0]["properties"][key] = {}
diff[1]["properties"][key] = {}
propdiff = (diff[0]["properties"][key],
......@@ -432,7 +433,7 @@ def compare_entities(entity0: Optional[Entity] = None,
# we have not yet compared properties that do not exist in entity0
for prop in entity1.properties:
key = prop.name if prop.name is not None else prop.id # ToDo: Would making id default break anything?
key = prop.name if prop.name is not None else prop.id
# check how often the property appears in entity0
num_prop_in_ent0 = len(entity0.properties.filter(prop))
if num_prop_in_ent0 == 0:
......@@ -448,7 +449,7 @@ def compare_entities(entity0: Optional[Entity] = None,
for index, parents, other_entity in [(0, entity0.parents, entity1),
(1, entity1.parents, entity0)]:
for parent in parents:
key = parent.name if parent.name is not None else parent.id # ToDo: Would making id default break anything?
key = parent.name if parent.name is not None else parent.id
matching = other_entity.parents.filter(parent)
if len(matching) == 0:
diff[index]["parents"].append(key)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment