Add tests for checking NotImplementedError
@@ -227,6 +227,30 @@ class TestMultiprocessIterator(unittest.TestCase):
self.assertRaises(StopIteration, it.next)
it.reset()
+ def test_unsupported_reset_middle(self):
+ dataset = [1, 2, 3, 4, 5]
+ it = iterators.MultiprocessIterator(
+ dataset, 2, repeat=False, **self.options)
+ it.next()
+ self.assertRaises(NotImplementedError, it.reset)
+
+ def test_unsupported_reset_repeat(self):
+ dataset = [1, 2, 3, 4]
+ it = iterators.MultiprocessIterator(
+ dataset, 2, repeat=True, **self.options)
+ it.next()
+ it.next()
+ self.assertRaises(NotImplementedError, it.reset)
+
+ def test_unsupported_reset_finalized(self):
+ dataset = [1, 2, 3, 4]
+ it = iterators.MultiprocessIterator(
+ dataset, 2, repeat=False, **self.options)
+ it.next()
+ it.next()
+ it.finalize()
+ self.assertRaises(NotImplementedError, it.reset)
+
@testing.parameterize(*testing.product({
'n_prefetch': [1, 2],
