(self)
| 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 |