MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_parameterized_slots_dict

Method test_parameterized_slots_dict

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

Source from the content-addressed store, hash-verified

5427 self.assertEqual(copy(C[int]), deepcopy(C[int]))
5428
5429 def test_parameterized_slots_dict(self):
5430 T = TypeVar('T')
5431 class D(Generic[T]):
5432 __slots__ = {'banana': 42}
5433
5434 d = D()
5435 d_int = D[int]()
5436
5437 d.banana = 'yes'
5438 d_int.banana = 'yes'
5439 with self.assertRaises(AttributeError):
5440 d.foobar = 'no'
5441 with self.assertRaises(AttributeError):
5442 d_int.foobar = 'no'
5443
5444 def test_errors(self):
5445 with self.assertRaises(TypeError):

Callers

nothing calls this directly

Calls 3

TypeVarClass · 0.85
DClass · 0.70
assertRaisesMethod · 0.45

Tested by

no test coverage detected