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

Method test_slots_after_items

Lib/test/test_descr.py:1323–1333  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1321 X().a
1322
1323 def test_slots_after_items(self):
1324 class C(tuple):
1325 __slots__ = ['a']
1326 x = C((1, 2, 3))
1327 self.assertNotHasAttr(x, "__dict__")
1328 self.assertNotHasAttr(x, "a")
1329 x.a = 42
1330 self.assertEqual(x.a, 42)
1331 del x.a
1332 self.assertNotHasAttr(x, "a")
1333 self.assertEqual(x, (1, 2, 3))
1334
1335 def test_slots_special(self):
1336 # Testing __dict__ and __weakref__ in __slots__...

Callers

nothing calls this directly

Calls 3

assertNotHasAttrMethod · 0.80
CClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected