(self)
| 3703 | self.assertIsInstance(HasNothingButSlots(), HasX) |
| 3704 | |
| 3705 | def test_protocols_isinstance_py36(self): |
| 3706 | class APoint: |
| 3707 | def __init__(self, x, y, label): |
| 3708 | self.x = x |
| 3709 | self.y = y |
| 3710 | self.label = label |
| 3711 | |
| 3712 | class BPoint: |
| 3713 | label = 'B' |
| 3714 | |
| 3715 | def __init__(self, x, y): |
| 3716 | self.x = x |
| 3717 | self.y = y |
| 3718 | |
| 3719 | class C: |
| 3720 | def __init__(self, attr): |
| 3721 | self.attr = attr |
| 3722 | |
| 3723 | def meth(self, arg): |
| 3724 | return 0 |
| 3725 | |
| 3726 | class Bad: pass |
| 3727 | |
| 3728 | self.assertIsInstance(APoint(1, 2, 'A'), Point) |
| 3729 | self.assertIsInstance(BPoint(1, 2), Point) |
| 3730 | self.assertNotIsInstance(MyPoint(), Point) |
| 3731 | self.assertIsInstance(BPoint(1, 2), Position) |
| 3732 | self.assertIsInstance(Other(), Proto) |
| 3733 | self.assertIsInstance(Concrete(), Proto) |
| 3734 | self.assertIsInstance(C(42), Proto) |
| 3735 | self.assertNotIsInstance(Bad(), Proto) |
| 3736 | self.assertNotIsInstance(Bad(), Point) |
| 3737 | self.assertNotIsInstance(Bad(), Position) |
| 3738 | self.assertNotIsInstance(Bad(), Concrete) |
| 3739 | self.assertNotIsInstance(Other(), Concrete) |
| 3740 | self.assertIsInstance(NT(1, 2), Position) |
| 3741 | |
| 3742 | def test_protocols_isinstance_init(self): |
| 3743 | T = TypeVar('T') |
nothing calls this directly
no test coverage detected