diff options
-rw-r--r-- | redis/commands/graph/edge.py | 4 | ||||
-rw-r--r-- | redis/commands/graph/node.py | 4 | ||||
-rw-r--r-- | redis/commands/graph/path.py | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/redis/commands/graph/edge.py b/redis/commands/graph/edge.py index b0141d9..6ee195f 100644 --- a/redis/commands/graph/edge.py +++ b/redis/commands/graph/edge.py @@ -61,6 +61,10 @@ class Edge: return res def __eq__(self, rhs): + # Type checking + if not isinstance(rhs, Edge): + return False + # Quick positive check, if both IDs are set. if self.id is not None and rhs.id is not None and self.id == rhs.id: return True diff --git a/redis/commands/graph/node.py b/redis/commands/graph/node.py index 0ebe510..4546a39 100644 --- a/redis/commands/graph/node.py +++ b/redis/commands/graph/node.py @@ -65,6 +65,10 @@ class Node: return res def __eq__(self, rhs): + # Type checking + if not isinstance(rhs, Node): + return False + # Quick positive check, if both IDs are set. if self.id is not None and rhs.id is not None and self.id != rhs.id: return False diff --git a/redis/commands/graph/path.py b/redis/commands/graph/path.py index 6f2214a..ee22dc8 100644 --- a/redis/commands/graph/path.py +++ b/redis/commands/graph/path.py @@ -54,6 +54,10 @@ class Path: return self def __eq__(self, other): + # Type checking + if not isinstance(other, Path): + return False + return self.nodes() == other.nodes() and self.edges() == other.edges() def __str__(self): |