def ugly_tree_creation_test(): tree = LookupTree() error_values = [] for i in range(10000): tree.insert(hash(i), (i, i)) n = 0 try: for k, v in tree: n += 1 if n != i+1: error_values.append(i) except TypeError: # this is failing the first time through the loop, because # integers aren't iterable. # I'm torn about what to think about this fact. # Probably just means I don't understand the tree as well as I thought print "Quit being able to iterate over tree on insert # %d" % i raise assert not error_values
def ugly_tree_creation_test(): tree = LookupTree() error_values = [] for i in range(10000): tree.insert(hash(i), (i, i)) n = 0 try: for k, v in tree: n += 1 if n != i + 1: error_values.append(i) except TypeError: # this is failing the first time through the loop, because # integers aren't iterable. # I'm torn about what to think about this fact. # Probably just means I don't understand the tree as well as I thought print "Quit being able to iterate over tree on insert # %d" % i raise assert not error_values