(self)
| 3740 | self.assertIsInstance(NT(1, 2), Position) |
| 3741 | |
| 3742 | def test_protocols_isinstance_init(self): |
| 3743 | T = TypeVar('T') |
| 3744 | |
| 3745 | @runtime_checkable |
| 3746 | class P(Protocol): |
| 3747 | x = 1 |
| 3748 | |
| 3749 | @runtime_checkable |
| 3750 | class PG(Protocol[T]): |
| 3751 | x = 1 |
| 3752 | |
| 3753 | class C: |
| 3754 | def __init__(self, x): |
| 3755 | self.x = x |
| 3756 | |
| 3757 | self.assertIsInstance(C(1), P) |
| 3758 | self.assertIsInstance(C(1), PG) |
| 3759 | |
| 3760 | def test_protocols_isinstance_monkeypatching(self): |
| 3761 | @runtime_checkable |
nothing calls this directly
no test coverage detected