def negative_find_test(): ok = True t = duptreap.duptreap() for i in xrange(0, n, 2): t[i] = i for i in xrange(1, n, 2): myut.require_exceptions(functools.partial(t.find, i), ( exceptions.LookupError, ))
def reremoval_test(): t = duptreap.duptreap() # fill the treap with 0..n for i in xrange(n): t[i] = i # remove all the odd values for i in xrange(1,n,2): del t[i] # check that we have nothing but even values left ordered_values = list(t.iterator()) for i in [ 1, 3, 7 ]: myut.require_exceptions(functools.partial(t.remove, i), ( exceptions.LookupError, ))
def empty_max_test(): t = duptreap.duptreap() myut.require_exceptions(t.find_max, (exceptions.LookupError, ))
def failed_removal_from_one_test(): t = duptreap.duptreap() t[5] = 5 myut.require_exceptions(functools.partial(t.remove, 10), ( exceptions.LookupError, ))
def removal_from_empty_test(): t = duptreap.duptreap() for i in [ 1, 3, 7 ]: myut.require_exceptions(functools.partial(t.remove, i), ( exceptions.LookupError, ))
def empty_min_test(): t = treap.treap() myut.require_exceptions(t.find_min, (exceptions.LookupError, ))