Skip to content

Commit 9a755d7

Browse files
committed
correction
1 parent 67d3df6 commit 9a755d7

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

pipeline/src/base.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@ def has_property(self, name):
3737

3838
def __eq__(self, other: Node) -> bool:
3939

40-
eq = True
4140
for property in self.properties:
4241
property_other = getattr(other, property.name, None)
4342
property_self = getattr(self, property.name, None)
44-
if property_other == property_self:
45-
pass
46-
else:
47-
eq = False
43+
if property_other != property_self:
44+
return False
4845

49-
return eq
46+
return True
5047

5148
def to_jsonld(self, include_empty_properties=True, embed_linked_nodes=True, with_context=True):
5249
"""

pipeline/src/collection.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,15 @@ def __iter__(self):
3737

3838
def __eq__(self, other):
3939

40-
eq = True
4140
# The current implementation assumes that nodes in both graphs are connected with the same link number.
42-
for key in self.nodes.keys():
43-
if key in other.nodes.keys():
44-
if self.nodes[key] != other.nodes[key]:
45-
eq = False
41+
for node_id in self.nodes:
42+
if node_id in other.nodes.keys():
43+
if self.nodes[node_id] != other.nodes[node_id]:
44+
return False
4645
else:
47-
eq = False
46+
return False
4847

49-
return eq
48+
return True
5049

5150
def add(self, *nodes):
5251
"""

pipeline/tests/test_collections.py

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def test_round_trip_multi_file():
6565
new_collection.load(test_output_dir)
6666

6767
assert len(collection) == len(new_collection)
68-
assert collection==new_collection
6968

7069
for node in new_collection:
7170
if node.id == person.id:

0 commit comments

Comments
 (0)