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

Method test_parameterized_slots_dict

Lib/test/test_typing.py:5536–5549  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5534 self.assertEqual(copy(C[int]), deepcopy(C[int]))
5535
5536 def test_parameterized_slots_dict(self):
5537 T = TypeVar('T')
5538 class D(Generic[T]):
5539 __slots__ = {'banana': 42}
5540
5541 d = D()
5542 d_int = D[int]()
5543
5544 d.banana = 'yes'
5545 d_int.banana = 'yes'
5546 with self.assertRaises(AttributeError):
5547 d.foobar = 'no'
5548 with self.assertRaises(AttributeError):
5549 d_int.foobar = 'no'
5550
5551 def test_errors(self):
5552 with self.assertRaises(TypeError):

Callers

nothing calls this directly

Calls 2

DClass · 0.70
assertRaisesMethod · 0.45

Tested by

no test coverage detected