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

Method test_protocols_isinstance_init

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

Source from the content-addressed store, hash-verified

3738 self.assertIsInstance(NT(1, 2), Position)
3739
3740 def test_protocols_isinstance_init(self):
3741 T = TypeVar('T')
3742
3743 @runtime_checkable
3744 class P(Protocol):
3745 x = 1
3746
3747 @runtime_checkable
3748 class PG(Protocol[T]):
3749 x = 1
3750
3751 class C:
3752 def __init__(self, x):
3753 self.x = x
3754
3755 self.assertIsInstance(C(1), P)
3756 self.assertIsInstance(C(1), PG)
3757
3758 def test_protocols_isinstance_monkeypatching(self):
3759 @runtime_checkable

Callers

nothing calls this directly

Calls 3

TypeVarClass · 0.85
assertIsInstanceMethod · 0.80
CClass · 0.70

Tested by

no test coverage detected