Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_itertools.TestBasicOps Class Reference

List of all members.

Public Member Functions

def test_accumulate
def test_chain
def test_chain_from_iterable
def test_combinations
def test_combinations_with_replacement
def test_permutations
def test_combinatorics
def test_compress
def test_count
def test_count_with_stride
def test_cycle
def test_groupby
def test_filter
def test_filterfalse
def test_zip
def test_ziplongest
def test_bug_7244
def test_product
def test_repeat
def test_map
def test_starmap
def test_islice
def test_takewhile
def test_dropwhile
def test_tee
def test_StopIteration

Public Attributes

 o
 t
 e

Detailed Description

Definition at line 58 of file test_itertools.py.


Member Function Documentation

Definition at line 60 of file test_itertools.py.

00060 
00061     def test_accumulate(self):
00062         self.assertEqual(list(accumulate(range(10))),               # one positional arg
00063                           [0, 1, 3, 6, 10, 15, 21, 28, 36, 45])
00064         self.assertEqual(list(accumulate(iterable=range(10))),      # kw arg
00065                           [0, 1, 3, 6, 10, 15, 21, 28, 36, 45])
00066         for typ in int, complex, Decimal, Fraction:                 # multiple types
00067             self.assertEqual(
00068                 list(accumulate(map(typ, range(10)))),
00069                 list(map(typ, [0, 1, 3, 6, 10, 15, 21, 28, 36, 45])))
00070         self.assertEqual(list(accumulate('abc')), ['a', 'ab', 'abc'])   # works with non-numeric
00071         self.assertEqual(list(accumulate([])), [])                  # empty iterable
00072         self.assertEqual(list(accumulate([7])), [7])                # iterable of length one
00073         self.assertRaises(TypeError, accumulate, range(10), 5)      # too many args
00074         self.assertRaises(TypeError, accumulate)                    # too few args
00075         self.assertRaises(TypeError, accumulate, x=range(10))       # unexpected kwd arg
00076         self.assertRaises(TypeError, list, accumulate([1, []]))     # args that don't add

Here is the call graph for this function:

Definition at line 616 of file test_itertools.py.

00616 
00617     def test_bug_7244(self):
00618 
00619         class Repeater:
00620             # this class is similar to itertools.repeat
00621             def __init__(self, o, t, e):
00622                 self.o = o
00623                 self.t = int(t)
00624                 self.e = e
00625             def __iter__(self): # its iterator is itself
00626                 return self
00627             def __next__(self):
00628                 if self.t > 0:
00629                     self.t -= 1
00630                     return self.o
00631                 else:
00632                     raise self.e
00633 
00634         # Formerly this code in would fail in debug mode
00635         # with Undetected Error and Stop Iteration
00636         r1 = Repeater(1, 3, StopIteration)
00637         r2 = Repeater(2, 4, StopIteration)
00638         def run(r1, r2):
00639             result = []
00640             for i, j in zip_longest(r1, r2, fillvalue=0):
00641                 with support.captured_output('stdout'):
00642                     print((i, j))
00643                 result.append((i, j))
00644             return result
00645         self.assertEqual(run(r1, r2), [(1,2), (1,2), (1,2), (0,2)])
00646 
00647         # Formerly, the RuntimeError would be lost
00648         # and StopIteration would stop as expected
00649         r1 = Repeater(1, 3, RuntimeError)
00650         r2 = Repeater(2, 4, StopIteration)
00651         it = zip_longest(r1, r2, fillvalue=0)
00652         self.assertEqual(next(it), (1, 2))
00653         self.assertEqual(next(it), (1, 2))
00654         self.assertEqual(next(it), (1, 2))
00655         self.assertRaises(RuntimeError, next, it)

Here is the call graph for this function:

Definition at line 77 of file test_itertools.py.

00077 
00078     def test_chain(self):
00079 
00080         def chain2(*iterables):
00081             'Pure python version in the docs'
00082             for it in iterables:
00083                 for element in it:
00084                     yield element
00085 
00086         for c in (chain, chain2):
00087             self.assertEqual(list(c('abc', 'def')), list('abcdef'))
00088             self.assertEqual(list(c('abc')), list('abc'))
00089             self.assertEqual(list(c('')), [])
00090             self.assertEqual(take(4, c('abc', 'def')), list('abcd'))
00091             self.assertRaises(TypeError, list,c(2, 3))

Here is the call graph for this function:

Definition at line 92 of file test_itertools.py.

00092 
00093     def test_chain_from_iterable(self):
00094         self.assertEqual(list(chain.from_iterable(['abc', 'def'])), list('abcdef'))
00095         self.assertEqual(list(chain.from_iterable(['abc'])), list('abc'))
00096         self.assertEqual(list(chain.from_iterable([''])), [])
00097         self.assertEqual(take(4, chain.from_iterable(['abc', 'def'])), list('abcd'))
00098         self.assertRaises(TypeError, list, chain.from_iterable([2, 3]))

Here is the call graph for this function:

Definition at line 99 of file test_itertools.py.

00099 
00100     def test_combinations(self):
00101         self.assertRaises(TypeError, combinations, 'abc')       # missing r argument
00102         self.assertRaises(TypeError, combinations, 'abc', 2, 1) # too many arguments
00103         self.assertRaises(TypeError, combinations, None)        # pool is not iterable
00104         self.assertRaises(ValueError, combinations, 'abc', -2)  # r is negative
00105         self.assertEqual(list(combinations('abc', 32)), [])     # r > n
00106         self.assertEqual(list(combinations(range(4), 3)),
00107                                            [(0,1,2), (0,1,3), (0,2,3), (1,2,3)])
00108 
00109         def combinations1(iterable, r):
00110             'Pure python version shown in the docs'
00111             pool = tuple(iterable)
00112             n = len(pool)
00113             if r > n:
00114                 return
00115             indices = list(range(r))
00116             yield tuple(pool[i] for i in indices)
00117             while 1:
00118                 for i in reversed(range(r)):
00119                     if indices[i] != i + n - r:
00120                         break
00121                 else:
00122                     return
00123                 indices[i] += 1
00124                 for j in range(i+1, r):
00125                     indices[j] = indices[j-1] + 1
00126                 yield tuple(pool[i] for i in indices)
00127 
00128         def combinations2(iterable, r):
00129             'Pure python version shown in the docs'
00130             pool = tuple(iterable)
00131             n = len(pool)
00132             for indices in permutations(range(n), r):
00133                 if sorted(indices) == list(indices):
00134                     yield tuple(pool[i] for i in indices)
00135 
00136         def combinations3(iterable, r):
00137             'Pure python version from cwr()'
00138             pool = tuple(iterable)
00139             n = len(pool)
00140             for indices in combinations_with_replacement(range(n), r):
00141                 if len(set(indices)) == r:
00142                     yield tuple(pool[i] for i in indices)
00143 
00144         for n in range(7):
00145             values = [5*x-12 for x in range(n)]
00146             for r in range(n+2):
00147                 result = list(combinations(values, r))
00148                 self.assertEqual(len(result), 0 if r>n else fact(n) / fact(r) / fact(n-r)) # right number of combs
00149                 self.assertEqual(len(result), len(set(result)))         # no repeats
00150                 self.assertEqual(result, sorted(result))                # lexicographic order
00151                 for c in result:
00152                     self.assertEqual(len(c), r)                         # r-length combinations
00153                     self.assertEqual(len(set(c)), r)                    # no duplicate elements
00154                     self.assertEqual(list(c), sorted(c))                # keep original ordering
00155                     self.assertTrue(all(e in values for e in c))           # elements taken from input iterable
00156                     self.assertEqual(list(c),
00157                                      [e for e in values if e in c])      # comb is a subsequence of the input iterable
00158                 self.assertEqual(result, list(combinations1(values, r))) # matches first pure python version
00159                 self.assertEqual(result, list(combinations2(values, r))) # matches second pure python version
00160                 self.assertEqual(result, list(combinations3(values, r))) # matches second pure python version
00161 
00162         # Test implementation detail:  tuple re-use
00163         self.assertEqual(len(set(map(id, combinations('abcde', 3)))), 1)
00164         self.assertNotEqual(len(set(map(id, list(combinations('abcde', 3))))), 1)

Here is the call graph for this function:

Definition at line 165 of file test_itertools.py.

00165 
00166     def test_combinations_with_replacement(self):
00167         cwr = combinations_with_replacement
00168         self.assertRaises(TypeError, cwr, 'abc')       # missing r argument
00169         self.assertRaises(TypeError, cwr, 'abc', 2, 1) # too many arguments
00170         self.assertRaises(TypeError, cwr, None)        # pool is not iterable
00171         self.assertRaises(ValueError, cwr, 'abc', -2)  # r is negative
00172         self.assertEqual(list(cwr('ABC', 2)),
00173                          [('A','A'), ('A','B'), ('A','C'), ('B','B'), ('B','C'), ('C','C')])
00174 
00175         def cwr1(iterable, r):
00176             'Pure python version shown in the docs'
00177             # number items returned:  (n+r-1)! / r! / (n-1)! when n>0
00178             pool = tuple(iterable)
00179             n = len(pool)
00180             if not n and r:
00181                 return
00182             indices = [0] * r
00183             yield tuple(pool[i] for i in indices)
00184             while 1:
00185                 for i in reversed(range(r)):
00186                     if indices[i] != n - 1:
00187                         break
00188                 else:
00189                     return
00190                 indices[i:] = [indices[i] + 1] * (r - i)
00191                 yield tuple(pool[i] for i in indices)
00192 
00193         def cwr2(iterable, r):
00194             'Pure python version shown in the docs'
00195             pool = tuple(iterable)
00196             n = len(pool)
00197             for indices in product(range(n), repeat=r):
00198                 if sorted(indices) == list(indices):
00199                     yield tuple(pool[i] for i in indices)
00200 
00201         def numcombs(n, r):
00202             if not n:
00203                 return 0 if r else 1
00204             return fact(n+r-1) / fact(r)/ fact(n-1)
00205 
00206         for n in range(7):
00207             values = [5*x-12 for x in range(n)]
00208             for r in range(n+2):
00209                 result = list(cwr(values, r))
00210 
00211                 self.assertEqual(len(result), numcombs(n, r))           # right number of combs
00212                 self.assertEqual(len(result), len(set(result)))         # no repeats
00213                 self.assertEqual(result, sorted(result))                # lexicographic order
00214 
00215                 regular_combs = list(combinations(values, r))           # compare to combs without replacement
00216                 if n == 0 or r <= 1:
00217                     self.assertEqual(result, regular_combs)            # cases that should be identical
00218                 else:
00219                     self.assertTrue(set(result) >= set(regular_combs))     # rest should be supersets of regular combs
00220 
00221                 for c in result:
00222                     self.assertEqual(len(c), r)                         # r-length combinations
00223                     noruns = [k for k,v in groupby(c)]                  # combo without consecutive repeats
00224                     self.assertEqual(len(noruns), len(set(noruns)))     # no repeats other than consecutive
00225                     self.assertEqual(list(c), sorted(c))                # keep original ordering
00226                     self.assertTrue(all(e in values for e in c))           # elements taken from input iterable
00227                     self.assertEqual(noruns,
00228                                      [e for e in values if e in c])     # comb is a subsequence of the input iterable
00229                 self.assertEqual(result, list(cwr1(values, r)))         # matches first pure python version
00230                 self.assertEqual(result, list(cwr2(values, r)))         # matches second pure python version
00231 
00232         # Test implementation detail:  tuple re-use
00233         self.assertEqual(len(set(map(id, cwr('abcde', 3)))), 1)
00234         self.assertNotEqual(len(set(map(id, list(cwr('abcde', 3))))), 1)

Here is the call graph for this function:

Definition at line 299 of file test_itertools.py.

00299 
00300     def test_combinatorics(self):
00301         # Test relationships between product(), permutations(),
00302         # combinations() and combinations_with_replacement().
00303 
00304         for n in range(6):
00305             s = 'ABCDEFG'[:n]
00306             for r in range(8):
00307                 prod = list(product(s, repeat=r))
00308                 cwr = list(combinations_with_replacement(s, r))
00309                 perm = list(permutations(s, r))
00310                 comb = list(combinations(s, r))
00311 
00312                 # Check size
00313                 self.assertEqual(len(prod), n**r)
00314                 self.assertEqual(len(cwr), (fact(n+r-1) / fact(r)/ fact(n-1)) if n else (not r))
00315                 self.assertEqual(len(perm), 0 if r>n else fact(n) / fact(n-r))
00316                 self.assertEqual(len(comb), 0 if r>n else fact(n) / fact(r) / fact(n-r))
00317 
00318                 # Check lexicographic order without repeated tuples
00319                 self.assertEqual(prod, sorted(set(prod)))
00320                 self.assertEqual(cwr, sorted(set(cwr)))
00321                 self.assertEqual(perm, sorted(set(perm)))
00322                 self.assertEqual(comb, sorted(set(comb)))
00323 
00324                 # Check interrelationships
00325                 self.assertEqual(cwr, [t for t in prod if sorted(t)==list(t)]) # cwr: prods which are sorted
00326                 self.assertEqual(perm, [t for t in prod if len(set(t))==r])    # perm: prods with no dups
00327                 self.assertEqual(comb, [t for t in perm if sorted(t)==list(t)]) # comb: perms that are sorted
00328                 self.assertEqual(comb, [t for t in cwr if len(set(t))==r])      # comb: cwrs without dups
00329                 self.assertEqual(comb, list(filter(set(cwr).__contains__, perm)))     # comb: perm that is a cwr
00330                 self.assertEqual(comb, list(filter(set(perm).__contains__, cwr)))     # comb: cwr that is a perm
00331                 self.assertEqual(comb, sorted(set(cwr) & set(perm)))            # comb: both a cwr and a perm

Here is the call graph for this function:

Definition at line 332 of file test_itertools.py.

00332 
00333     def test_compress(self):
00334         self.assertEqual(list(compress(data='ABCDEF', selectors=[1,0,1,0,1,1])), list('ACEF'))
00335         self.assertEqual(list(compress('ABCDEF', [1,0,1,0,1,1])), list('ACEF'))
00336         self.assertEqual(list(compress('ABCDEF', [0,0,0,0,0,0])), list(''))
00337         self.assertEqual(list(compress('ABCDEF', [1,1,1,1,1,1])), list('ABCDEF'))
00338         self.assertEqual(list(compress('ABCDEF', [1,0,1])), list('AC'))
00339         self.assertEqual(list(compress('ABC', [0,1,1,1,1,1])), list('BC'))
00340         n = 10000
00341         data = chain.from_iterable(repeat(range(6), n))
00342         selectors = chain.from_iterable(repeat((0, 1)))
00343         self.assertEqual(list(compress(data, selectors)), [1,3,5] * n)
00344         self.assertRaises(TypeError, compress, None, range(6))      # 1st arg not iterable
00345         self.assertRaises(TypeError, compress, range(6), None)      # 2nd arg not iterable
00346         self.assertRaises(TypeError, compress, range(6))            # too few args
00347         self.assertRaises(TypeError, compress, range(6), None)      # too many args

Here is the call graph for this function:

Definition at line 348 of file test_itertools.py.

00348 
00349     def test_count(self):
00350         self.assertEqual(lzip('abc',count()), [('a', 0), ('b', 1), ('c', 2)])
00351         self.assertEqual(lzip('abc',count(3)), [('a', 3), ('b', 4), ('c', 5)])
00352         self.assertEqual(take(2, lzip('abc',count(3))), [('a', 3), ('b', 4)])
00353         self.assertEqual(take(2, zip('abc',count(-1))), [('a', -1), ('b', 0)])
00354         self.assertEqual(take(2, zip('abc',count(-3))), [('a', -3), ('b', -2)])
00355         self.assertRaises(TypeError, count, 2, 3, 4)
00356         self.assertRaises(TypeError, count, 'a')
00357         self.assertEqual(list(islice(count(maxsize-5), 10)),
00358                          list(range(maxsize-5, maxsize+5)))
00359         self.assertEqual(list(islice(count(-maxsize-5), 10)),
00360                          list(range(-maxsize-5, -maxsize+5)))
00361         self.assertEqual(list(islice(count(10, maxsize+5), 3)),
00362                          list(range(10, 10+3*(maxsize+5), maxsize+5)))
00363         c = count(3)
00364         self.assertEqual(repr(c), 'count(3)')
00365         next(c)
00366         self.assertEqual(repr(c), 'count(4)')
00367         c = count(-9)
00368         self.assertEqual(repr(c), 'count(-9)')
00369         next(c)
00370         self.assertEqual(repr(count(10.25)), 'count(10.25)')
00371         self.assertEqual(next(c), -8)
00372         for i in (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 10, sys.maxsize-5, sys.maxsize+5):
00373             # Test repr (ignoring the L in longs)
00374             r1 = repr(count(i)).replace('L', '')
00375             r2 = 'count(%r)'.__mod__(i).replace('L', '')
00376             self.assertEqual(r1, r2)
00377 
00378         # check copy, deepcopy, pickle
00379         for value in -3, 3, maxsize-5, maxsize+5:
00380             c = count(value)
00381             self.assertEqual(next(copy.copy(c)), value)
00382             self.assertEqual(next(copy.deepcopy(c)), value)
00383             self.assertEqual(next(pickle.loads(pickle.dumps(c))), value)
00384 
00385         #check proper internal error handling for large "step' sizes
00386         count(1, maxsize+5); sys.exc_info()

Here is the call graph for this function:

Definition at line 387 of file test_itertools.py.

00387 
00388     def test_count_with_stride(self):
00389         self.assertEqual(lzip('abc',count(2,3)), [('a', 2), ('b', 5), ('c', 8)])
00390         self.assertEqual(lzip('abc',count(start=2,step=3)),
00391                          [('a', 2), ('b', 5), ('c', 8)])
00392         self.assertEqual(lzip('abc',count(step=-1)),
00393                          [('a', 0), ('b', -1), ('c', -2)])
00394         self.assertEqual(lzip('abc',count(2,0)), [('a', 2), ('b', 2), ('c', 2)])
00395         self.assertEqual(lzip('abc',count(2,1)), [('a', 2), ('b', 3), ('c', 4)])
00396         self.assertEqual(lzip('abc',count(2,3)), [('a', 2), ('b', 5), ('c', 8)])
00397         self.assertEqual(take(20, count(maxsize-15, 3)), take(20, range(maxsize-15, maxsize+100, 3)))
00398         self.assertEqual(take(20, count(-maxsize-15, 3)), take(20, range(-maxsize-15,-maxsize+100, 3)))
00399         self.assertEqual(take(3, count(2, 3.25-4j)), [2, 5.25-4j, 8.5-8j])
00400         self.assertEqual(take(3, count(Decimal('1.1'), Decimal('.1'))),
00401                          [Decimal('1.1'), Decimal('1.2'), Decimal('1.3')])
00402         self.assertEqual(take(3, count(Fraction(2,3), Fraction(1,7))),
00403                          [Fraction(2,3), Fraction(17,21), Fraction(20,21)])
00404         self.assertEqual(repr(take(3, count(10, 2.5))), repr([10, 12.5, 15.0]))
00405         c = count(3, 5)
00406         self.assertEqual(repr(c), 'count(3, 5)')
00407         next(c)
00408         self.assertEqual(repr(c), 'count(8, 5)')
00409         c = count(-9, 0)
00410         self.assertEqual(repr(c), 'count(-9, 0)')
00411         next(c)
00412         self.assertEqual(repr(c), 'count(-9, 0)')
00413         c = count(-9, -3)
00414         self.assertEqual(repr(c), 'count(-9, -3)')
00415         next(c)
00416         self.assertEqual(repr(c), 'count(-12, -3)')
00417         self.assertEqual(repr(c), 'count(-12, -3)')
00418         self.assertEqual(repr(count(10.5, 1.25)), 'count(10.5, 1.25)')
00419         self.assertEqual(repr(count(10.5, 1)), 'count(10.5)')           # suppress step=1 when it's an int
00420         self.assertEqual(repr(count(10.5, 1.00)), 'count(10.5, 1.0)')   # do show float values lilke 1.0
00421         for i in (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 10, sys.maxsize-5, sys.maxsize+5):
00422             for j in  (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 1, 10, sys.maxsize-5, sys.maxsize+5):
00423                 # Test repr (ignoring the L in longs)
00424                 r1 = repr(count(i, j)).replace('L', '')
00425                 if j == 1:
00426                     r2 = ('count(%r)' % i).replace('L', '')
00427                 else:
00428                     r2 = ('count(%r, %r)' % (i, j)).replace('L', '')
00429                 self.assertEqual(r1, r2)

Here is the call graph for this function:

Definition at line 430 of file test_itertools.py.

00430 
00431     def test_cycle(self):
00432         self.assertEqual(take(10, cycle('abc')), list('abcabcabca'))
00433         self.assertEqual(list(cycle('')), [])
00434         self.assertRaises(TypeError, cycle)
00435         self.assertRaises(TypeError, cycle, 5)
00436         self.assertEqual(list(islice(cycle(gen3()),10)), [0,1,2,0,1,2,0,1,2,0])

Here is the call graph for this function:

Definition at line 833 of file test_itertools.py.

00833 
00834     def test_dropwhile(self):
00835         data = [1, 3, 5, 20, 2, 4, 6, 8]
00836         underten = lambda x: x<10
00837         self.assertEqual(list(dropwhile(underten, data)), [20, 2, 4, 6, 8])
00838         self.assertEqual(list(dropwhile(underten, [])), [])
00839         self.assertRaises(TypeError, dropwhile)
00840         self.assertRaises(TypeError, dropwhile, operator.pow)
00841         self.assertRaises(TypeError, dropwhile, operator.pow, [(4,5)], 'extra')
00842         self.assertRaises(TypeError, next, dropwhile(10, [(4,5)]))
00843         self.assertRaises(ValueError, next, dropwhile(errfunc, [(4,5)]))

Here is the call graph for this function:

Definition at line 526 of file test_itertools.py.

00526 
00527     def test_filter(self):
00528         self.assertEqual(list(filter(isEven, range(6))), [0,2,4])
00529         self.assertEqual(list(filter(None, [0,1,0,2,0])), [1,2])
00530         self.assertEqual(list(filter(bool, [0,1,0,2,0])), [1,2])
00531         self.assertEqual(take(4, filter(isEven, count())), [0,2,4,6])
00532         self.assertRaises(TypeError, filter)
00533         self.assertRaises(TypeError, filter, lambda x:x)
00534         self.assertRaises(TypeError, filter, lambda x:x, range(6), 7)
00535         self.assertRaises(TypeError, filter, isEven, 3)
00536         self.assertRaises(TypeError, next, filter(range(6), range(6)))

Here is the call graph for this function:

Definition at line 537 of file test_itertools.py.

00537 
00538     def test_filterfalse(self):
00539         self.assertEqual(list(filterfalse(isEven, range(6))), [1,3,5])
00540         self.assertEqual(list(filterfalse(None, [0,1,0,2,0])), [0,0,0])
00541         self.assertEqual(list(filterfalse(bool, [0,1,0,2,0])), [0,0,0])
00542         self.assertEqual(take(4, filterfalse(isEven, count())), [1,3,5,7])
00543         self.assertRaises(TypeError, filterfalse)
00544         self.assertRaises(TypeError, filterfalse, lambda x:x)
00545         self.assertRaises(TypeError, filterfalse, lambda x:x, range(6), 7)
00546         self.assertRaises(TypeError, filterfalse, isEven, 3)
00547         self.assertRaises(TypeError, next, filterfalse(range(6), range(6)))

Here is the call graph for this function:

Definition at line 437 of file test_itertools.py.

00437 
00438     def test_groupby(self):
00439         # Check whether it accepts arguments correctly
00440         self.assertEqual([], list(groupby([])))
00441         self.assertEqual([], list(groupby([], key=id)))
00442         self.assertRaises(TypeError, list, groupby('abc', []))
00443         self.assertRaises(TypeError, groupby, None)
00444         self.assertRaises(TypeError, groupby, 'abc', lambda x:x, 10)
00445 
00446         # Check normal input
00447         s = [(0, 10, 20), (0, 11,21), (0,12,21), (1,13,21), (1,14,22),
00448              (2,15,22), (3,16,23), (3,17,23)]
00449         dup = []
00450         for k, g in groupby(s, lambda r:r[0]):
00451             for elem in g:
00452                 self.assertEqual(k, elem[0])
00453                 dup.append(elem)
00454         self.assertEqual(s, dup)
00455 
00456         # Check nested case
00457         dup = []
00458         for k, g in groupby(s, lambda r:r[0]):
00459             for ik, ig in groupby(g, lambda r:r[2]):
00460                 for elem in ig:
00461                     self.assertEqual(k, elem[0])
00462                     self.assertEqual(ik, elem[2])
00463                     dup.append(elem)
00464         self.assertEqual(s, dup)
00465 
00466         # Check case where inner iterator is not used
00467         keys = [k for k, g in groupby(s, lambda r:r[0])]
00468         expectedkeys = set([r[0] for r in s])
00469         self.assertEqual(set(keys), expectedkeys)
00470         self.assertEqual(len(keys), len(expectedkeys))
00471 
00472         # Exercise pipes and filters style
00473         s = 'abracadabra'
00474         # sort s | uniq
00475         r = [k for k, g in groupby(sorted(s))]
00476         self.assertEqual(r, ['a', 'b', 'c', 'd', 'r'])
00477         # sort s | uniq -d
00478         r = [k for k, g in groupby(sorted(s)) if list(islice(g,1,2))]
00479         self.assertEqual(r, ['a', 'b', 'r'])
00480         # sort s | uniq -c
00481         r = [(len(list(g)), k) for k, g in groupby(sorted(s))]
00482         self.assertEqual(r, [(5, 'a'), (2, 'b'), (1, 'c'), (1, 'd'), (2, 'r')])
00483         # sort s | uniq -c | sort -rn | head -3
00484         r = sorted([(len(list(g)) , k) for k, g in groupby(sorted(s))], reverse=True)[:3]
00485         self.assertEqual(r, [(5, 'a'), (2, 'r'), (2, 'b')])
00486 
00487         # iter.__next__ failure
00488         class ExpectedError(Exception):
00489             pass
00490         def delayed_raise(n=0):
00491             for i in range(n):
00492                 yield 'yo'
00493             raise ExpectedError
00494         def gulp(iterable, keyp=None, func=list):
00495             return [func(g) for k, g in groupby(iterable, keyp)]
00496 
00497         # iter.__next__ failure on outer object
00498         self.assertRaises(ExpectedError, gulp, delayed_raise(0))
00499         # iter.__next__ failure on inner object
00500         self.assertRaises(ExpectedError, gulp, delayed_raise(1))
00501 
00502         # __cmp__ failure
00503         class DummyCmp:
00504             def __eq__(self, dst):
00505                 raise ExpectedError
00506         s = [DummyCmp(), DummyCmp(), None]
00507 
00508         # __eq__ failure on outer object
00509         self.assertRaises(ExpectedError, gulp, s, func=id)
00510         # __eq__ failure on inner object
00511         self.assertRaises(ExpectedError, gulp, s)
00512 
00513         # keyfunc failure
00514         def keyfunc(obj):
00515             if keyfunc.skip > 0:
00516                 keyfunc.skip -= 1
00517                 return obj
00518             else:
00519                 raise ExpectedError
00520 
00521         # keyfunc failure on outer object
00522         keyfunc.skip = 0
00523         self.assertRaises(ExpectedError, gulp, [None], keyfunc)
00524         keyfunc.skip = 1
00525         self.assertRaises(ExpectedError, gulp, [None, None], keyfunc)

Here is the call graph for this function:

Definition at line 769 of file test_itertools.py.

00769 
00770     def test_islice(self):
00771         for args in [          # islice(args) should agree with range(args)
00772                 (10, 20, 3),
00773                 (10, 3, 20),
00774                 (10, 20),
00775                 (10, 3),
00776                 (20,)
00777                 ]:
00778             self.assertEqual(list(islice(range(100), *args)),
00779                              list(range(*args)))
00780 
00781         for args, tgtargs in [  # Stop when seqn is exhausted
00782                 ((10, 110, 3), ((10, 100, 3))),
00783                 ((10, 110), ((10, 100))),
00784                 ((110,), (100,))
00785                 ]:
00786             self.assertEqual(list(islice(range(100), *args)),
00787                              list(range(*tgtargs)))
00788 
00789         # Test stop=None
00790         self.assertEqual(list(islice(range(10), None)), list(range(10)))
00791         self.assertEqual(list(islice(range(10), None, None)), list(range(10)))
00792         self.assertEqual(list(islice(range(10), None, None, None)), list(range(10)))
00793         self.assertEqual(list(islice(range(10), 2, None)), list(range(2, 10)))
00794         self.assertEqual(list(islice(range(10), 1, None, 2)), list(range(1, 10, 2)))
00795 
00796         # Test number of items consumed     SF #1171417
00797         it = iter(range(10))
00798         self.assertEqual(list(islice(it, 3)), list(range(3)))
00799         self.assertEqual(list(it), list(range(3, 10)))
00800 
00801         # Test invalid arguments
00802         self.assertRaises(TypeError, islice, range(10))
00803         self.assertRaises(TypeError, islice, range(10), 1, 2, 3, 4)
00804         self.assertRaises(ValueError, islice, range(10), -5, 10, 1)
00805         self.assertRaises(ValueError, islice, range(10), 1, -5, -1)
00806         self.assertRaises(ValueError, islice, range(10), 1, 10, -1)
00807         self.assertRaises(ValueError, islice, range(10), 1, 10, 0)
00808         self.assertRaises(ValueError, islice, range(10), 'a')
00809         self.assertRaises(ValueError, islice, range(10), 'a', 1)
00810         self.assertRaises(ValueError, islice, range(10), 1, 'a')
00811         self.assertRaises(ValueError, islice, range(10), 'a', 1, 1)
00812         self.assertRaises(ValueError, islice, range(10), 1, 'a', 1)
00813         self.assertEqual(len(list(islice(count(), 1, 10, maxsize))), 1)
00814 
00815         # Issue #10323:  Less islice in a predictable state
00816         c = count()
00817         self.assertEqual(list(islice(c, 1, 3, 50)), [1])
00818         self.assertEqual(next(c), 3)

Here is the call graph for this function:

Definition at line 736 of file test_itertools.py.

00736 
00737     def test_map(self):
00738         self.assertEqual(list(map(operator.pow, range(3), range(1,7))),
00739                          [0**1, 1**2, 2**3])
00740         def tupleize(*args):
00741             return args
00742         self.assertEqual(list(map(tupleize, 'abc', range(5))),
00743                          [('a',0),('b',1),('c',2)])
00744         self.assertEqual(list(map(tupleize, 'abc', count())),
00745                          [('a',0),('b',1),('c',2)])
00746         self.assertEqual(take(2,map(tupleize, 'abc', count())),
00747                          [('a',0),('b',1)])
00748         self.assertEqual(list(map(operator.pow, [])), [])
00749         self.assertRaises(TypeError, map)
00750         self.assertRaises(TypeError, list, map(None, range(3), range(3)))
00751         self.assertRaises(TypeError, map, operator.neg)
00752         self.assertRaises(TypeError, next, map(10, range(5)))
00753         self.assertRaises(ValueError, next, map(errfunc, [4], [5]))
00754         self.assertRaises(TypeError, next, map(onearg, [4], [5]))

Here is the call graph for this function:

Definition at line 235 of file test_itertools.py.

00235 
00236     def test_permutations(self):
00237         self.assertRaises(TypeError, permutations)              # too few arguments
00238         self.assertRaises(TypeError, permutations, 'abc', 2, 1) # too many arguments
00239         self.assertRaises(TypeError, permutations, None)        # pool is not iterable
00240         self.assertRaises(ValueError, permutations, 'abc', -2)  # r is negative
00241         self.assertEqual(list(permutations('abc', 32)), [])     # r > n
00242         self.assertRaises(TypeError, permutations, 'abc', 's')  # r is not an int or None
00243         self.assertEqual(list(permutations(range(3), 2)),
00244                                            [(0,1), (0,2), (1,0), (1,2), (2,0), (2,1)])
00245 
00246         def permutations1(iterable, r=None):
00247             'Pure python version shown in the docs'
00248             pool = tuple(iterable)
00249             n = len(pool)
00250             r = n if r is None else r
00251             if r > n:
00252                 return
00253             indices = list(range(n))
00254             cycles = list(range(n-r+1, n+1))[::-1]
00255             yield tuple(pool[i] for i in indices[:r])
00256             while n:
00257                 for i in reversed(range(r)):
00258                     cycles[i] -= 1
00259                     if cycles[i] == 0:
00260                         indices[i:] = indices[i+1:] + indices[i:i+1]
00261                         cycles[i] = n - i
00262                     else:
00263                         j = cycles[i]
00264                         indices[i], indices[-j] = indices[-j], indices[i]
00265                         yield tuple(pool[i] for i in indices[:r])
00266                         break
00267                 else:
00268                     return
00269 
00270         def permutations2(iterable, r=None):
00271             'Pure python version shown in the docs'
00272             pool = tuple(iterable)
00273             n = len(pool)
00274             r = n if r is None else r
00275             for indices in product(range(n), repeat=r):
00276                 if len(set(indices)) == r:
00277                     yield tuple(pool[i] for i in indices)
00278 
00279         for n in range(7):
00280             values = [5*x-12 for x in range(n)]
00281             for r in range(n+2):
00282                 result = list(permutations(values, r))
00283                 self.assertEqual(len(result), 0 if r>n else fact(n) / fact(n-r))      # right number of perms
00284                 self.assertEqual(len(result), len(set(result)))         # no repeats
00285                 self.assertEqual(result, sorted(result))                # lexicographic order
00286                 for p in result:
00287                     self.assertEqual(len(p), r)                         # r-length permutations
00288                     self.assertEqual(len(set(p)), r)                    # no duplicate elements
00289                     self.assertTrue(all(e in values for e in p))           # elements taken from input iterable
00290                 self.assertEqual(result, list(permutations1(values, r))) # matches first pure python version
00291                 self.assertEqual(result, list(permutations2(values, r))) # matches second pure python version
00292                 if r == n:
00293                     self.assertEqual(result, list(permutations(values, None))) # test r as None
00294                     self.assertEqual(result, list(permutations(values)))       # test default r
00295 
00296         # Test implementation detail:  tuple re-use
00297         self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1)
00298         self.assertNotEqual(len(set(map(id, list(permutations('abcde', 3))))), 1)

Here is the call graph for this function:

Definition at line 656 of file test_itertools.py.

00656 
00657     def test_product(self):
00658         for args, result in [
00659             ([], [()]),                     # zero iterables
00660             (['ab'], [('a',), ('b',)]),     # one iterable
00661             ([range(2), range(3)], [(0,0), (0,1), (0,2), (1,0), (1,1), (1,2)]),     # two iterables
00662             ([range(0), range(2), range(3)], []),           # first iterable with zero length
00663             ([range(2), range(0), range(3)], []),           # middle iterable with zero length
00664             ([range(2), range(3), range(0)], []),           # last iterable with zero length
00665             ]:
00666             self.assertEqual(list(product(*args)), result)
00667             for r in range(4):
00668                 self.assertEqual(list(product(*(args*r))),
00669                                  list(product(*args, **dict(repeat=r))))
00670         self.assertEqual(len(list(product(*[range(7)]*6))), 7**6)
00671         self.assertRaises(TypeError, product, range(6), None)
00672 
00673         def product1(*args, **kwds):
00674             pools = list(map(tuple, args)) * kwds.get('repeat', 1)
00675             n = len(pools)
00676             if n == 0:
00677                 yield ()
00678                 return
00679             if any(len(pool) == 0 for pool in pools):
00680                 return
00681             indices = [0] * n
00682             yield tuple(pool[i] for pool, i in zip(pools, indices))
00683             while 1:
00684                 for i in reversed(range(n)):  # right to left
00685                     if indices[i] == len(pools[i]) - 1:
00686                         continue
00687                     indices[i] += 1
00688                     for j in range(i+1, n):
00689                         indices[j] = 0
00690                     yield tuple(pool[i] for pool, i in zip(pools, indices))
00691                     break
00692                 else:
00693                     return
00694 
00695         def product2(*args, **kwds):
00696             'Pure python version used in docs'
00697             pools = list(map(tuple, args)) * kwds.get('repeat', 1)
00698             result = [[]]
00699             for pool in pools:
00700                 result = [x+[y] for x in result for y in pool]
00701             for prod in result:
00702                 yield tuple(prod)
00703 
00704         argtypes = ['', 'abc', '', range(0), range(4), dict(a=1, b=2, c=3),
00705                     set('abcdefg'), range(11), tuple(range(13))]
00706         for i in range(100):
00707             args = [random.choice(argtypes) for j in range(random.randrange(5))]
00708             expected_len = prod(map(len, args))
00709             self.assertEqual(len(list(product(*args))), expected_len)
00710             self.assertEqual(list(product(*args)), list(product1(*args)))
00711             self.assertEqual(list(product(*args)), list(product2(*args)))
00712             args = map(iter, args)
00713             self.assertEqual(len(list(product(*args))), expected_len)
00714 
00715         # Test implementation detail:  tuple re-use
00716         self.assertEqual(len(set(map(id, product('abc', 'def')))), 1)
00717         self.assertNotEqual(len(set(map(id, list(product('abc', 'def'))))), 1)

Here is the call graph for this function:

Definition at line 718 of file test_itertools.py.

00718 
00719     def test_repeat(self):
00720         self.assertEqual(list(repeat(object='a', times=3)), ['a', 'a', 'a'])
00721         self.assertEqual(lzip(range(3),repeat('a')),
00722                          [(0, 'a'), (1, 'a'), (2, 'a')])
00723         self.assertEqual(list(repeat('a', 3)), ['a', 'a', 'a'])
00724         self.assertEqual(take(3, repeat('a')), ['a', 'a', 'a'])
00725         self.assertEqual(list(repeat('a', 0)), [])
00726         self.assertEqual(list(repeat('a', -3)), [])
00727         self.assertRaises(TypeError, repeat)
00728         self.assertRaises(TypeError, repeat, None, 3, 4)
00729         self.assertRaises(TypeError, repeat, None, 'a')
00730         r = repeat(1+0j)
00731         self.assertEqual(repr(r), 'repeat((1+0j))')
00732         r = repeat(1+0j, 5)
00733         self.assertEqual(repr(r), 'repeat((1+0j), 5)')
00734         list(r)
00735         self.assertEqual(repr(r), 'repeat((1+0j), 0)')

Here is the call graph for this function:

Definition at line 755 of file test_itertools.py.

00755 
00756     def test_starmap(self):
00757         self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))),
00758                          [0**1, 1**2, 2**3])
00759         self.assertEqual(take(3, starmap(operator.pow, zip(count(), count(1)))),
00760                          [0**1, 1**2, 2**3])
00761         self.assertEqual(list(starmap(operator.pow, [])), [])
00762         self.assertEqual(list(starmap(operator.pow, [iter([4,5])])), [4**5])
00763         self.assertRaises(TypeError, list, starmap(operator.pow, [None]))
00764         self.assertRaises(TypeError, starmap)
00765         self.assertRaises(TypeError, starmap, operator.pow, [(4,5)], 'extra')
00766         self.assertRaises(TypeError, next, starmap(10, [(4,5)]))
00767         self.assertRaises(ValueError, next, starmap(errfunc, [(4,5)]))
00768         self.assertRaises(TypeError, next, starmap(onearg, [(4,5)]))

Here is the call graph for this function:

Definition at line 933 of file test_itertools.py.

00933 
00934     def test_StopIteration(self):
00935         self.assertRaises(StopIteration, next, zip())
00936 
00937         for f in (chain, cycle, zip, groupby):
00938             self.assertRaises(StopIteration, next, f([]))
00939             self.assertRaises(StopIteration, next, f(StopNow()))
00940 
00941         self.assertRaises(StopIteration, next, islice([], None))
00942         self.assertRaises(StopIteration, next, islice(StopNow(), None))
00943 
00944         p, q = tee([])
00945         self.assertRaises(StopIteration, next, p)
00946         self.assertRaises(StopIteration, next, q)
00947         p, q = tee(StopNow())
00948         self.assertRaises(StopIteration, next, p)
00949         self.assertRaises(StopIteration, next, q)
00950 
00951         self.assertRaises(StopIteration, next, repeat(None, 0))
00952 
00953         for f in (filter, filterfalse, map, takewhile, dropwhile, starmap):
00954             self.assertRaises(StopIteration, next, f(lambda x:x, []))
00955             self.assertRaises(StopIteration, next, f(lambda x:x, StopNow()))

Here is the call graph for this function:

Definition at line 819 of file test_itertools.py.

00819 
00820     def test_takewhile(self):
00821         data = [1, 3, 5, 20, 2, 4, 6, 8]
00822         underten = lambda x: x<10
00823         self.assertEqual(list(takewhile(underten, data)), [1, 3, 5])
00824         self.assertEqual(list(takewhile(underten, [])), [])
00825         self.assertRaises(TypeError, takewhile)
00826         self.assertRaises(TypeError, takewhile, operator.pow)
00827         self.assertRaises(TypeError, takewhile, operator.pow, [(4,5)], 'extra')
00828         self.assertRaises(TypeError, next, takewhile(10, [(4,5)]))
00829         self.assertRaises(ValueError, next, takewhile(errfunc, [(4,5)]))
00830         t = takewhile(bool, [1, 1, 1, 0, 0, 0])
00831         self.assertEqual(list(t), [1, 1, 1])
00832         self.assertRaises(StopIteration, next, t)

Here is the call graph for this function:

Definition at line 844 of file test_itertools.py.

00844 
00845     def test_tee(self):
00846         n = 200
00847         def irange(n):
00848             for i in range(n):
00849                 yield i
00850 
00851         a, b = tee([])        # test empty iterator
00852         self.assertEqual(list(a), [])
00853         self.assertEqual(list(b), [])
00854 
00855         a, b = tee(irange(n)) # test 100% interleaved
00856         self.assertEqual(lzip(a,b), lzip(range(n), range(n)))
00857 
00858         a, b = tee(irange(n)) # test 0% interleaved
00859         self.assertEqual(list(a), list(range(n)))
00860         self.assertEqual(list(b), list(range(n)))
00861 
00862         a, b = tee(irange(n)) # test dealloc of leading iterator
00863         for i in range(100):
00864             self.assertEqual(next(a), i)
00865         del a
00866         self.assertEqual(list(b), list(range(n)))
00867 
00868         a, b = tee(irange(n)) # test dealloc of trailing iterator
00869         for i in range(100):
00870             self.assertEqual(next(a), i)
00871         del b
00872         self.assertEqual(list(a), list(range(100, n)))
00873 
00874         for j in range(5):   # test randomly interleaved
00875             order = [0]*n + [1]*n
00876             random.shuffle(order)
00877             lists = ([], [])
00878             its = tee(irange(n))
00879             for i in order:
00880                 value = next(its[i])
00881                 lists[i].append(value)
00882             self.assertEqual(lists[0], list(range(n)))
00883             self.assertEqual(lists[1], list(range(n)))
00884 
00885         # test argument format checking
00886         self.assertRaises(TypeError, tee)
00887         self.assertRaises(TypeError, tee, 3)
00888         self.assertRaises(TypeError, tee, [1,2], 'x')
00889         self.assertRaises(TypeError, tee, [1,2], 3, 'x')
00890 
00891         # tee object should be instantiable
00892         a, b = tee('abc')
00893         c = type(a)('def')
00894         self.assertEqual(list(c), list('def'))
00895 
00896         # test long-lagged and multi-way split
00897         a, b, c = tee(range(2000), 3)
00898         for i in range(100):
00899             self.assertEqual(next(a), i)
00900         self.assertEqual(list(b), list(range(2000)))
00901         self.assertEqual([next(c), next(c)], list(range(2)))
00902         self.assertEqual(list(a), list(range(100,2000)))
00903         self.assertEqual(list(c), list(range(2,2000)))
00904 
00905         # test values of n
00906         self.assertRaises(TypeError, tee, 'abc', 'invalid')
00907         self.assertRaises(ValueError, tee, [], -1)
00908         for n in range(5):
00909             result = tee('abc', n)
00910             self.assertEqual(type(result), tuple)
00911             self.assertEqual(len(result), n)
00912             self.assertEqual([list(x) for x in result], [list('abc')]*n)
00913 
00914         # tee pass-through to copyable iterator
00915         a, b = tee('abc')
00916         c, d = tee(a)
00917         self.assertTrue(a is c)
00918 
00919         # test tee_new
00920         t1, t2 = tee('abc')
00921         tnew = type(t1)
00922         self.assertRaises(TypeError, tnew)
00923         self.assertRaises(TypeError, tnew, 10)
00924         t3 = tnew(t1)
00925         self.assertTrue(list(t1) == list(t2) == list(t3) == list('abc'))
00926 
00927         # test that tee objects are weak referencable
00928         a, b = tee(range(10))
00929         p = proxy(a)
00930         self.assertEqual(getattr(p, '__class__'), type(b))
00931         del a
00932         self.assertRaises(ReferenceError, getattr, p, '__class__')

Here is the call graph for this function:

Definition at line 548 of file test_itertools.py.

00548 
00549     def test_zip(self):
00550         # XXX This is rather silly now that builtin zip() calls zip()...
00551         ans = [(x,y) for x, y in zip('abc',count())]
00552         self.assertEqual(ans, [('a', 0), ('b', 1), ('c', 2)])
00553         self.assertEqual(list(zip('abc', range(6))), lzip('abc', range(6)))
00554         self.assertEqual(list(zip('abcdef', range(3))), lzip('abcdef', range(3)))
00555         self.assertEqual(take(3,zip('abcdef', count())), lzip('abcdef', range(3)))
00556         self.assertEqual(list(zip('abcdef')), lzip('abcdef'))
00557         self.assertEqual(list(zip()), lzip())
00558         self.assertRaises(TypeError, zip, 3)
00559         self.assertRaises(TypeError, zip, range(3), 3)
00560         # Check tuple re-use (implementation detail)
00561         self.assertEqual([tuple(list(pair)) for pair in zip('abc', 'def')],
00562                          lzip('abc', 'def'))
00563         self.assertEqual([pair for pair in zip('abc', 'def')],
00564                          lzip('abc', 'def'))
00565         ids = list(map(id, zip('abc', 'def')))
00566         self.assertEqual(min(ids), max(ids))
00567         ids = list(map(id, list(zip('abc', 'def'))))
00568         self.assertEqual(len(dict.fromkeys(ids)), len(ids))

Here is the call graph for this function:

Definition at line 569 of file test_itertools.py.

00569 
00570     def test_ziplongest(self):
00571         for args in [
00572                 ['abc', range(6)],
00573                 [range(6), 'abc'],
00574                 [range(1000), range(2000,2100), range(3000,3050)],
00575                 [range(1000), range(0), range(3000,3050), range(1200), range(1500)],
00576                 [range(1000), range(0), range(3000,3050), range(1200), range(1500), range(0)],
00577             ]:
00578             target = [tuple([arg[i] if i < len(arg) else None for arg in args])
00579                       for i in range(max(map(len, args)))]
00580             self.assertEqual(list(zip_longest(*args)), target)
00581             self.assertEqual(list(zip_longest(*args, **{})), target)
00582             target = [tuple((e is None and 'X' or e) for e in t) for t in target]   # Replace None fills with 'X'
00583             self.assertEqual(list(zip_longest(*args, **dict(fillvalue='X'))), target)
00584 
00585         self.assertEqual(take(3,zip_longest('abcdef', count())), list(zip('abcdef', range(3)))) # take 3 from infinite input
00586 
00587         self.assertEqual(list(zip_longest()), list(zip()))
00588         self.assertEqual(list(zip_longest([])), list(zip([])))
00589         self.assertEqual(list(zip_longest('abcdef')), list(zip('abcdef')))
00590 
00591         self.assertEqual(list(zip_longest('abc', 'defg', **{})),
00592                          list(zip(list('abc')+[None], 'defg'))) # empty keyword dict
00593         self.assertRaises(TypeError, zip_longest, 3)
00594         self.assertRaises(TypeError, zip_longest, range(3), 3)
00595 
00596         for stmt in [
00597             "zip_longest('abc', fv=1)",
00598             "zip_longest('abc', fillvalue=1, bogus_keyword=None)",
00599         ]:
00600             try:
00601                 eval(stmt, globals(), locals())
00602             except TypeError:
00603                 pass
00604             else:
00605                 self.fail('Did not raise Type in:  ' + stmt)
00606 
00607         # Check tuple re-use (implementation detail)
00608         self.assertEqual([tuple(list(pair)) for pair in zip_longest('abc', 'def')],
00609                          list(zip('abc', 'def')))
00610         self.assertEqual([pair for pair in zip_longest('abc', 'def')],
00611                          list(zip('abc', 'def')))
00612         ids = list(map(id, zip_longest('abc', 'def')))
00613         self.assertEqual(min(ids), max(ids))
00614         ids = list(map(id, list(zip_longest('abc', 'def'))))
00615         self.assertEqual(len(dict.fromkeys(ids)), len(ids))

Here is the call graph for this function:


Member Data Documentation

Definition at line 623 of file test_itertools.py.

Definition at line 621 of file test_itertools.py.

Definition at line 622 of file test_itertools.py.


The documentation for this class was generated from the following file: