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

Class C

Lib/test/test_descr.py:418–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416 self.assertIs(d.__class__, dict)
417 self.assertIsInstance(d, dict)
418 class C(dict):
419 state = -1
420 def __init__(self_local, *a, **kw):
421 if a:
422 self.assertEqual(len(a), 1)
423 self_local.state = a[0]
424 if kw:
425 for k, v in list(kw.items()):
426 self_local[v] = k
427 def __getitem__(self, key):
428 return self.get(key, 0)
429 def __setitem__(self_local, key, value):
430 self.assertIsInstance(key, int)
431 dict.__setitem__(self_local, key, value)
432 def setstate(self, state):
433 self.state = state
434 def getstate(self):
435 return self.state
436 self.assertIsSubclass(C, dict)
437 a1 = C(12)
438 self.assertEqual(a1.state, 12)

Callers

nothing calls this directly

Calls 3

computed_attributeClass · 0.85
propertyClass · 0.85
DescrClass · 0.70

Tested by

no test coverage detected