Skip to content

Commit b9828ed

Browse files
authored
Check all of node's labels when comparing nodes for equality (#159)
1 parent a8b39c8 commit b9828ed

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

redisgraph/node.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def __eq__(self, rhs):
5454
if self.id is not None and rhs.id is not None and self.id != rhs.id:
5555
return False
5656

57-
# Label should match.
58-
if self.label != rhs.label:
57+
# Labels should match.
58+
if self.labels != rhs.labels:
5959
return False
6060

6161
# Quick check for number of properties.

tests/unit/test_node.py

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ def test_comparision(self):
5050
self.assertNotEqual(node.Node(alias="a", label="l"),
5151
node.Node(alias="a", label="l1"))
5252

53+
self.assertEqual(node.Node(alias="a", label=["a", "b"]),
54+
node.Node(alias="a", label=["a", "b"]))
55+
56+
self.assertNotEqual(node.Node(alias="a", label=["a", "b"]),
57+
node.Node(alias="a", label=["a", "c"]))
58+
5359
self.assertEqual(node.Node(properties={"a": 10}),
5460
node.Node(properties={"a": 10}))
5561
self.assertNotEqual(node.Node(), node.Node(properties={"a": 10}))

0 commit comments

Comments
 (0)