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

Method test_instantiate

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

Source from the content-addressed store, hash-verified

9702 hash(a2)
9703
9704 def test_instantiate(self):
9705 class C:
9706 classvar = 4
9707
9708 def __init__(self, x):
9709 self.x = x
9710
9711 def __eq__(self, other):
9712 if not isinstance(other, C):
9713 return NotImplemented
9714 return other.x == self.x
9715
9716 A = Annotated[C, "a decoration"]
9717 a = A(5)
9718 c = C(5)
9719 self.assertEqual(a, c)
9720 self.assertEqual(a.x, c.x)
9721 self.assertEqual(a.classvar, c.classvar)
9722
9723 def test_instantiate_generic(self):
9724 MyCount = Annotated[typing.Counter[T], "my decoration"]

Callers

nothing calls this directly

Calls 3

AClass · 0.70
CClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected