bench-pycrypt.py
def TestArgRange(testname, *args, **kwargs):
    """ generate tests, enumerating through a set of arguments """

    # cur contains the current index set
    cur = [0 for _ in range(len(kwargs))]
    # end contains the max index for the specific args.
    end = [len(_) if type(_)==tuple else 1 for _ in kwargs.values()]
    while True:
        # build arg list
        kw = {}
        for (k, v), i in zip(kwargs.items(), cur):
            if type(v)==tuple:
                kw[k] = v[i]
            else:
                kw[k] = v

        # create test
        yield testname(*args, **kw)

        # increment ix list
        i = 0
        while i<len(cur) and cur[i]==end[i]-1:
            cur[i] = 0
            i += 1
        while i<len(cur) and end[i]==1:
            i += 1
        if i<len(cur):
            cur[i] += 1
        else:
            break
 generate tests, enumerating through a set of arguments 
generate tests, enumerating through a set of arguments
generate tests enumerating through a set of arguments
def TestArgRange(testname, *args, **kwargs):
    cur = [0 for _ in range(len(kwargs))]
    end = [len(_) if type(_)==tuple else 1 for _ in kwargs.values()]
    while True:
        kw = {}
        for (k, v), i in zip(kwargs.items(), cur):
            if type(v)==tuple:
                kw[k] = v[i]
            else:
                kw[k] = v
        yield testname(*args, **kw)
        i = 0
        while i<len(cur) and cur[i]==end[i]-1:
            cur[i] = 0
            i += 1
        while i<len(cur) and end[i]==1:
            i += 1
        if i<len(cur):
            cur[i] += 1
        else:
            break
def TestArgRange ( testname , * args , ** kwargs ) : cur = [ 0 for _ in range ( len ( kwargs ) ) ] end = [ len ( _ ) if type ( _ ) == tuple else 1 for _ in kwargs . values ( ) ] while True : kw = { } for ( k , v ) , i in zip ( kwargs . items ( ) , cur ) : if type ( v ) == tuple : kw [ k ] = v [ i ] else : kw [ k ] = v yield testname ( * args , ** kw ) i = 0 while i < len ( cur ) and cur [ i ] == end [ i ] - 1 : cur [ i ] = 0 i += 1 while i < len ( cur ) and end [ i ] == 1 : i += 1 if i < len ( cur ) : cur [ i ] += 1 else : break
generate tests, enumerating through a set of arguments
generate tests enumerating through a set of arguments
""" generate tests, enumerating through a set of arguments """ # cur contains the current index set # end contains the max index for the specific args. # build arg list # create test # increment ix list
testname