Skip to content
Snippets Groups Projects
Commit 15393549 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

MAINT: moved check for multi-properties for clarity

parent bceb49a9
No related branches found
No related tags found
2 merge requests!107ENH: add entity getters and cached functions,!103Improving the compare_entities functions
......@@ -207,6 +207,7 @@ def compare_entities(old_entity: Entity, new_entity: Entity,
- Information about properties:
- Each property lists either an additional property or a property with a changed:
- datatype
- unit
- importance or
- value
......@@ -287,6 +288,9 @@ def compare_entities(old_entity: Entity, new_entity: Entity,
if len(matching_old) != 1:
raise NotImplementedError(
"Comparison not implemented for multi-properties.")
if len(matching) > 1:
raise NotImplementedError(
"Comparison not implemented for multi-properties.")
if len(matching) == 0:
olddiff["properties"][prop.name] = {}
......@@ -342,9 +346,7 @@ def compare_entities(old_entity: Entity, new_entity: Entity,
newdiff["properties"].pop(prop.name)
olddiff["properties"].pop(prop.name)
else:
raise NotImplementedError(
"Comparison not implemented for multi-properties.")
for prop in new_entity.properties:
if len([0 for p in old_entity.properties if p.name == prop.name]) == 0:
......
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