(self)
| 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 |
nothing calls this directly
no test coverage detected