MCPcopy Index your code
hub / github.com/python/cpython / check_iterator

Method check_iterator

Lib/test/test_iter.py:110–120  ·  view source on GitHub ↗
(self, it, seq, pickle=True)

Source from the content-addressed store, hash-verified

108
109 # Helper to check that an iterator returns a given sequence
110 def check_iterator(self, it, seq, pickle=True):
111 if pickle:
112 self.check_pickle(it, seq)
113 res = []
114 while 1:
115 try:
116 val = next(it)
117 except StopIteration:
118 break
119 res.append(val)
120 self.assertEqual(res, seq)
121
122 # Helper to check that a for loop generates a given sequence
123 def check_for_loop(self, expr, seq, pickle=True):

Callers 6

test_iter_basicMethod · 0.95
test_iter_class_iterMethod · 0.95
test_seq_class_iterMethod · 0.95
test_iter_callableMethod · 0.95
test_iter_functionMethod · 0.95

Calls 3

check_pickleMethod · 0.95
assertEqualMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected