MCPcopy
hub / github.com/more-itertools/more-itertools / test_slicing_error

Method test_slicing_error

tests/test_more.py:317–331  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

315 self.assertEqual(actual, expected, slice_args)
316
317 def test_slicing_error(self):
318 iterable = '01234567'
319 p = mi.peekable(iter(iterable))
320
321 # Prime the cache
322 p.peek()
323 old_cache = list(p._cache)
324
325 # Illegal slice
326 with self.assertRaises(ValueError):
327 p[1:-1:0]
328
329 # Neither the cache nor the iteration should be affected
330 self.assertEqual(old_cache, list(p._cache))
331 self.assertEqual(list(p), list(iterable))
332
333 # prepend() behavior tests
334

Callers

nothing calls this directly

Calls 1

peekMethod · 0.45

Tested by

no test coverage detected