MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_newobj_proxies

Method test_newobj_proxies

Lib/test/pickletester.py:3201–3218  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

proxyMethod · 0.80
CClass · 0.70
BClass · 0.70
removeMethod · 0.45
dumpsMethod · 0.45
loadsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected