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

Method test_StopIteration

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

Source from the content-addressed store, hash-verified

1439 thread.join()
1440
1441 def test_StopIteration(self):
1442 self.assertRaises(StopIteration, next, zip())
1443
1444 for f in (chain, cycle, zip, groupby):
1445 self.assertRaises(StopIteration, next, f([]))
1446 self.assertRaises(StopIteration, next, f(StopNow()))
1447
1448 self.assertRaises(StopIteration, next, islice([], None))
1449 self.assertRaises(StopIteration, next, islice(StopNow(), None))
1450
1451 p, q = tee([])
1452 self.assertRaises(StopIteration, next, p)
1453 self.assertRaises(StopIteration, next, q)
1454 p, q = tee(StopNow())
1455 self.assertRaises(StopIteration, next, p)
1456 self.assertRaises(StopIteration, next, q)
1457
1458 self.assertRaises(StopIteration, next, repeat(None, 0))
1459
1460 for f in (filter, filterfalse, map, takewhile, dropwhile, starmap):
1461 self.assertRaises(StopIteration, next, f(lambda x:x, []))
1462 self.assertRaises(StopIteration, next, f(lambda x:x, StopNow()))
1463
1464 @support.cpython_only
1465 def test_combinations_result_gc(self):

Callers

nothing calls this directly

Calls 4

StopNowClass · 0.85
fFunction · 0.70
repeatFunction · 0.50
assertRaisesMethod · 0.45

Tested by

no test coverage detected