Commit ce4586cb authored by Trond Aasan's avatar Trond Aasan
Browse files

Add id_key to comparisons and skip instance check

parent 43f129df
......@@ -47,9 +47,13 @@ class Tree(Generic[T]):
return f"Tree(data={self.data}, children={self.children})"
def __eq__(self, other):
if not isinstance(other, Tree):
return False
return self.data == other.data and self.children == other.children
return all(
[
self.id_key == other.id_key,
self.data == other.data,
self.children == other.children,
]
)
def values(self) -> Iterator[T]:
for x in self:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment