(self, itorg, seq)
| 130 | |
| 131 | # Helper to check picklability |
| 132 | def check_pickle(self, itorg, seq): |
| 133 | for proto in range(pickle.HIGHEST_PROTOCOL + 1): |
| 134 | d = pickle.dumps(itorg, proto) |
| 135 | it = pickle.loads(d) |
| 136 | # Cannot assert type equality because dict iterators unpickle as list |
| 137 | # iterators. |
| 138 | # self.assertEqual(type(itorg), type(it)) |
| 139 | self.assertTrue(isinstance(it, collections.abc.Iterator)) |
| 140 | self.assertEqual(list(it), seq) |
| 141 | |
| 142 | it = pickle.loads(d) |
| 143 | try: |
| 144 | next(it) |
| 145 | except StopIteration: |
| 146 | continue |
| 147 | d = pickle.dumps(it, proto) |
| 148 | it = pickle.loads(d) |
| 149 | self.assertEqual(list(it), seq[1:]) |
| 150 | |
| 151 | # Test basic use of iter() function |
| 152 | def test_iter_basic(self): |
no test coverage detected