Commit f954213c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f6724b5f
......@@ -51,12 +51,14 @@ class Tree:
t.keyv = tuple(keyv)
t.children = tuple(children)
def __hash__(t):
return hash(t.keyv) ^ hash(t.children)
def __ne__(a, b):
return not (a == b)
def __eq__(a, b):
if not isinstance(b, Tree):
return False
return (a.keyv == b.keyv) and (a.children == b.children) # XXX don't compare .children here?
def __hash__(t):
return hash(t.keyv) ^ hash(t.children) # XXX children ^^^
return (a.keyv == b.keyv) and (a.children == b.children)
def __str__(t):
s = "T([" + ",".join(['%s' % _ for _ in t.keyv]) + "]"
......@@ -79,12 +81,14 @@ class Bucket:
_assertIncv(keyv)
b.keyv = tuple(keyv)
def __hash__(b):
return hash(b.keyv)
def __ne__(a, b):
return not (a == b)
def __eq__(a, b):
if not isinstance(b, Bucket):
return False
return a.keyv == b.keyv
def __hash__(b):
return hash(b.keyv)
def __str__(b):
return "B(" + ','.join(['%s' % _ for _ in b.keyv]) + ")"
......
......@@ -115,6 +115,15 @@ def test_AllStructs():
]
print('\n\nAAA\n\n')
q = X([1,3], 1, 1)
print()
r = q[0]
print(r)
z = T([], B(1,3))
print(z)
print(r == z)
print()
1/0
assert X([1,3], 1, 1) == [
# nsplit=0, depth=0
T([], B(1,3)),
......
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