b'\xacL\t\xc2\x06\xe7\xe34/]\n^HBx\xc3\xa9g\xb3g\x11\xeb\x87\xbd\xc1\xf7z\x7f\x86X\x95C\xe4v(3\x81\x86&Hb|\xc1M\x9e\xc3\x04\xbd\xfc\xe8\xd4eO\xd6\xba\x1a\xe6WX\xdexO\x8f\x92ZUD\xf2P\x16c\x9c\xc1\x83s\xf7\x13ZTq\x9e\xf3\x84\xdd\x02\x8e\xf1\x0f\xce\x17\x16+\xd3\xb5\n)\xd3\x9cz\xf4\xfb\xd3*7\x1b\xdej\xf1p>\xf3\xba'
This is its test data. It wrote these random bytes into the tree, and verifies that they come back right.
[(9, 9, 0, 45), (9, 18, 45, 39), (3, 21, 84, 13), (1, 22, 97, 1), (1, 23, 98, 8), (-1, b'j\xf1p>\xf3\xba', 106, 6)]
This looks like the tree index after the final write. The tuples are edges linking to older indices (subtrees). The final component is the most recent data, and some metadata regarding it.
Traceback (most recent call last): File "/shared/src/flat_tree/test.py", line 43, in <module> This is the test file.
cmp = b''.join(iterate(index, 0, index.byte_count))
Okay, insid the outer test file, it is iterating over an index, the range being the entire data, and joining the bytes together. On line 43. So it hasn't compared the data yet: it's inside the function that returns it.
File "/shared/src/flat_tree/test.py", line 30, in iterate data = b''.join(iterate(subindex, adjusted_start, min(adjusted_end, subsize - adjusted_start)))
Looks like the iterate function is local to the test file, and it looks like it calls itself recursively. I'm vaguely remembering that the library presently just generates indices and doesn't provide much of an interface to them. So here it is doing a recursive call. Given the call up the stack is in the main file body, this is likely iterating at one level below the root index. It would be appropriate to know the values of the parameters passed to the function here.
File "/shared/src/flat_tree/test.py", line 34, in iterate assert len(data) == subleafcount AssertionError
Now it's _still_ inside the iterate function in the main file, and an assertion is failing. And now I have helpful information: this assertion must be failing regarding data in the second row of the tree. This helps me so much as before I had no context for the failure. len(data) == subleafcount implies that data is a list of all the trees below the tree. So it likely already performed a depth-first enumeration of every child of this node, and is preparing to return out to the parent call. Time to visit it in pdb.