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

Method test_instantiate

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

Source from the content-addressed store, hash-verified

9578 hash(a2)
9579
9580 def test_instantiate(self):
9581 class C:
9582 classvar = 4
9583
9584 def __init__(self, x):
9585 self.x = x
9586
9587 def __eq__(self, other):
9588 if not isinstance(other, C):
9589 return NotImplemented
9590 return other.x == self.x
9591
9592 A = Annotated[C, "a decoration"]
9593 a = A(5)
9594 c = C(5)
9595 self.assertEqual(a, c)
9596 self.assertEqual(a.x, c.x)
9597 self.assertEqual(a.classvar, c.classvar)
9598
9599 def test_instantiate_generic(self):
9600 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