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

Method test_dict_dematerialization_copy

Lib/test/test_opcache.py:1257–1281  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1255 self.assertIs(c.__dict__, d)
1256
1257 def test_dict_dematerialization_copy(self):
1258 c = C()
1259 c.a = 1
1260 c.b = 2
1261 c2 = copy.copy(c)
1262 for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
1263 c.a
1264 c2.a
1265 self.assertEqual(
1266 _testinternalcapi.get_object_dict_values(c),
1267 (1, 2, '<NULL>')
1268 )
1269 self.assertEqual(
1270 _testinternalcapi.get_object_dict_values(c2),
1271 (1, 2, '<NULL>')
1272 )
1273 c3 = copy.deepcopy(c)
1274 for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
1275 c.a
1276 c3.a
1277 self.assertEqual(
1278 _testinternalcapi.get_object_dict_values(c),
1279 (1, 2, '<NULL>')
1280 )
1281 #NOTE -- c3.__dict__ does not de-materialize
1282
1283 def test_dict_dematerialization_pickle(self):
1284 c = C()

Callers

nothing calls this directly

Calls 3

CClass · 0.70
copyMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected