(self)
| 3623 | self.assertGreaterEqual(num_additems, 2) |
| 3624 | |
| 3625 | def test_simple_newobj(self): |
| 3626 | x = SimpleNewObj.__new__(SimpleNewObj, 0xface) # avoid __init__ |
| 3627 | x.abc = 666 |
| 3628 | for proto in protocols: |
| 3629 | with self.subTest(proto=proto): |
| 3630 | if self.py_version < (3, 0) and proto < 2: |
| 3631 | self.skipTest('int subclasses are not interoperable with Python 2') |
| 3632 | s = self.dumps(x, proto) |
| 3633 | if proto < 1: |
| 3634 | if self.py_version >= (3, 7): |
| 3635 | self.assertIn(b'\nI64206', s) # INT |
| 3636 | else: # for test_xpickle |
| 3637 | self.assertIn(b'64206', s) # INT or LONG |
| 3638 | else: |
| 3639 | self.assertIn(b'M\xce\xfa', s) # BININT2 |
| 3640 | if not (self.py_version < (3, 5) and proto == 4): |
| 3641 | self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), |
| 3642 | 2 <= proto) |
| 3643 | self.assertFalse(opcode_in_pickle(pickle.NEWOBJ_EX, s)) |
| 3644 | y = self.loads(s) # will raise TypeError if __init__ called |
| 3645 | self.assert_is_copy(x, y) |
| 3646 | |
| 3647 | def test_complex_newobj(self): |
| 3648 | x = ComplexNewObj.__new__(ComplexNewObj, 0xface) # avoid __init__ |
nothing calls this directly
no test coverage detected