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

Method test_chain

Lib/test/test_itertools.py:202–215  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

200 batches.append(last_batch)
201
202 def test_chain(self):
203
204 def chain2(*iterables):
205 'Pure python version in the docs'
206 for it in iterables:
207 for element in it:
208 yield element
209
210 for c in (chain, chain2):
211 self.assertEqual(list(c('abc', 'def')), list('abcdef'))
212 self.assertEqual(list(c('abc')), list('abc'))
213 self.assertEqual(list(c('')), [])
214 self.assertEqual(take(4, c('abc', 'def')), list('abcd'))
215 self.assertRaises(TypeError, list,c(2, 3))
216
217 def test_chain_from_iterable(self):
218 self.assertEqual(list(chain.from_iterable(['abc', 'def'])), list('abcdef'))

Callers

nothing calls this directly

Calls 5

listClass · 0.85
takeFunction · 0.85
cClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected