| 3199 | self.assertEqual(x.__dict__, y.__dict__, detail) |
| 3200 | |
| 3201 | def test_newobj_proxies(self): |
| 3202 | # NEWOBJ should use the __class__ rather than the raw type |
| 3203 | classes = myclasses[:] |
| 3204 | # Cannot create weakproxies to these classes |
| 3205 | for c in (MyInt, MyTuple): |
| 3206 | classes.remove(c) |
| 3207 | for proto in protocols: |
| 3208 | for C in classes: |
| 3209 | B = C.__base__ |
| 3210 | x = C(C.sample) |
| 3211 | x.foo = 42 |
| 3212 | p = weakref.proxy(x) |
| 3213 | s = self.dumps(p, proto) |
| 3214 | y = self.loads(s) |
| 3215 | self.assertEqual(type(y), type(x)) # rather than type(p) |
| 3216 | detail = (proto, C, B, x, y, type(y)) |
| 3217 | self.assertEqual(B(x), B(y), detail) |
| 3218 | self.assertEqual(x.__dict__, y.__dict__, detail) |
| 3219 | |
| 3220 | def test_newobj_overridden_new(self): |
| 3221 | # Test that Python class with C implemented __new__ is pickleable |