(self)
| 3645 | self.assert_is_copy(x, y) |
| 3646 | |
| 3647 | def test_complex_newobj(self): |
| 3648 | x = ComplexNewObj.__new__(ComplexNewObj, 0xface) # avoid __init__ |
| 3649 | x.abc = 666 |
| 3650 | for proto in protocols: |
| 3651 | with self.subTest(proto=proto): |
| 3652 | if self.py_version < (3, 0) and proto < 2: |
| 3653 | self.skipTest('int subclasses are not interoperable with Python 2') |
| 3654 | s = self.dumps(x, proto) |
| 3655 | if proto < 1: |
| 3656 | if self.py_version >= (3, 7): |
| 3657 | self.assertIn(b'\nI64206', s) # INT |
| 3658 | else: # for test_xpickle |
| 3659 | self.assertIn(b'64206', s) # INT or LONG |
| 3660 | elif proto < 2: |
| 3661 | self.assertIn(b'M\xce\xfa', s) # BININT2 |
| 3662 | elif proto < 4: |
| 3663 | if self.py_version >= (3, 0): |
| 3664 | self.assertIn(b'X\x04\x00\x00\x00FACE', s) # BINUNICODE |
| 3665 | else: # for test_xpickle |
| 3666 | self.assertIn(b'U\x04FACE', s) # SHORT_BINSTRING |
| 3667 | else: |
| 3668 | self.assertIn(b'\x8c\x04FACE', s) # SHORT_BINUNICODE |
| 3669 | if not (self.py_version < (3, 5) and proto == 4): |
| 3670 | self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), |
| 3671 | 2 <= proto) |
| 3672 | self.assertFalse(opcode_in_pickle(pickle.NEWOBJ_EX, s)) |
| 3673 | y = self.loads(s) # will raise TypeError if __init__ called |
| 3674 | self.assert_is_copy(x, y) |
| 3675 | |
| 3676 | def test_complex_newobj_ex(self): |
| 3677 | if self.py_version < (3, 4): |
nothing calls this directly
no test coverage detected