(self)
| 849 | """ |
| 850 | |
| 851 | def test_construct(self): |
| 852 | def _check_iterator(it): |
| 853 | self.assertIsInstance(it, abc.Iterator) |
| 854 | self.assertIsInstance(it, abc.Iterable) |
| 855 | s = struct.Struct('>ibcp') |
| 856 | it = s.iter_unpack(b"") |
| 857 | _check_iterator(it) |
| 858 | it = s.iter_unpack(b"1234567") |
| 859 | _check_iterator(it) |
| 860 | # Wrong bytes length |
| 861 | with self.assertRaises(struct.error): |
| 862 | s.iter_unpack(b"123456") |
| 863 | with self.assertRaises(struct.error): |
| 864 | s.iter_unpack(b"12345678") |
| 865 | # Zero-length struct |
| 866 | s = struct.Struct('>') |
| 867 | with self.assertRaises(struct.error): |
| 868 | s.iter_unpack(b"") |
| 869 | with self.assertRaises(struct.error): |
| 870 | s.iter_unpack(b"12") |
| 871 | |
| 872 | def test_uninstantiable(self): |
| 873 | iter_unpack_type = type(struct.Struct(">ibcp").iter_unpack(b"")) |
nothing calls this directly
no test coverage detected