Skip to content
Snippets Groups Projects

Improving the compare_entities functions

2 files
+ 10
7
Compare changes
  • Side-by-side
  • Inline

Files

+ 2
3
@@ -239,7 +239,7 @@ def compare_entities(old_entity: Entity, new_entity: Entity,
if isinstance(entity, Property):
raise NotImplementedError("The function compare_entities does not work for "
"comparing abstract properties.")
olddiff: Dict[str, Any] = {"properties": {}, "parents": []}
newdiff: Dict[str, Any] = {"properties": {}, "parents": []}
@@ -347,7 +347,6 @@ def compare_entities(old_entity: Entity, new_entity: Entity,
newdiff["properties"].pop(prop.name)
olddiff["properties"].pop(prop.name)
# Check whether there are missing properties in old_entity, additionally
# check for multi-properties that are currently not supported:
for prop in new_entity.properties:
@@ -355,7 +354,7 @@ def compare_entities(old_entity: Entity, new_entity: Entity,
if len(matching) > 1:
raise NotImplementedError(
"Comparison not implemented for multi-properties.")
if len([0 for p in old_entity.properties if p.name == prop.name]) == 0:
newdiff["properties"][prop.name] = {}
Loading