(self)
| 349 | assertStructError(struct.unpack, format, b"") |
| 350 | |
| 351 | def test_p_code(self): |
| 352 | # Test p ("Pascal string") code. |
| 353 | for code, input, expected, expectedback in [ |
| 354 | ('0p', b'abc', b'', b''), |
| 355 | ('p', b'abc', b'\x00', b''), |
| 356 | ('1p', b'abc', b'\x00', b''), |
| 357 | ('2p', b'abc', b'\x01a', b'a'), |
| 358 | ('3p', b'abc', b'\x02ab', b'ab'), |
| 359 | ('4p', b'abc', b'\x03abc', b'abc'), |
| 360 | ('5p', b'abc', b'\x03abc\x00', b'abc'), |
| 361 | ('6p', b'abc', b'\x03abc\x00\x00', b'abc'), |
| 362 | ('1000p', b'x'*1000, b'\xff' + b'x'*999, b'x'*255)]: |
| 363 | got = struct.pack(code, input) |
| 364 | self.assertEqual(got, expected) |
| 365 | (got,) = struct.unpack(code, got) |
| 366 | self.assertEqual(got, expectedback) |
| 367 | |
| 368 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 369 | def test_705836(self): |
nothing calls this directly
no test coverage detected