MCPcopy Index your code
hub / github.com/python/cpython / test_attribute_name_interning

Method test_attribute_name_interning

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

Source from the content-addressed store, hash-verified

3773 self.assert_is_copy(obj, loaded)
3774
3775 def test_attribute_name_interning(self):
3776 # Test that attribute names of pickled objects are interned when
3777 # unpickling.
3778 if self.py_version < (3, 0):
3779 self.skipTest('"classic" classes are not interoperable with Python 2')
3780 for proto in protocols:
3781 x = C()
3782 x.foo = 42
3783 x.bar = "hello"
3784 s = self.dumps(x, proto)
3785 y = self.loads(s)
3786 x_keys = sorted(x.__dict__)
3787 y_keys = sorted(y.__dict__)
3788 for x_key, y_key in zip(x_keys, y_keys):
3789 self.assertIs(x_key, y_key)
3790
3791 def test_pickle_to_2x(self):
3792 # Pickle non-trivial data with protocol 2, expecting that it yields

Callers

nothing calls this directly

Calls 5

skipTestMethod · 0.80
CClass · 0.70
dumpsMethod · 0.45
loadsMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected