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

Method test_instantiate_immutable

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

Source from the content-addressed store, hash-verified

9602 self.assertEqual(MyCount[int]([4, 4, 5]), {4: 2, 5: 1})
9603
9604 def test_instantiate_immutable(self):
9605 class C:
9606 def __setattr__(self, key, value):
9607 raise Exception("should be ignored")
9608
9609 A = Annotated[C, "a decoration"]
9610 # gh-115165: This used to cause RuntimeError to be raised
9611 # when we tried to set `__orig_class__` on the `C` instance
9612 # returned by the `A()` call
9613 self.assertIsInstance(A(), C)
9614
9615 def test_cannot_instantiate_forward(self):
9616 A = Annotated["int", (5, 6)]

Callers

nothing calls this directly

Calls 2

assertIsInstanceMethod · 0.80
AClass · 0.70

Tested by

no test coverage detected