| 1229 | # This wrapper is used to test that the base class iterator doesn't invoke |
| 1230 | # the wrapper self.__next__ function accidentally |
| 1231 | class IteratorWrapper(BaseIterator): |
| 1232 | def __init__(self, *args, **kwargs): |
| 1233 | self._allow_next = False |
| 1234 | super(IteratorWrapper, self).__init__(*args, **kwargs) |
| 1235 | |
| 1236 | # Asserting if __next__ is called, unless self._allow_next has been set to True explicitly |
| 1237 | def __next__(self): |
| 1238 | assert self._allow_next |
| 1239 | _ = super(IteratorWrapper, self).__next__() |
| 1240 | |
| 1241 | pipe = Pipeline(batch_size=16, num_threads=1, device_id=0) |
| 1242 | with pipe: |
no outgoing calls