(self)
| 2942 | self.assertIsInstance(f, HasCallProtocol) |
| 2943 | |
| 2944 | def test_no_inheritance_from_nominal(self): |
| 2945 | class C: pass |
| 2946 | |
| 2947 | class BP(Protocol): pass |
| 2948 | |
| 2949 | with self.assertRaises(TypeError): |
| 2950 | class P(C, Protocol): |
| 2951 | pass |
| 2952 | with self.assertRaises(TypeError): |
| 2953 | class Q(Protocol, C): |
| 2954 | pass |
| 2955 | with self.assertRaises(TypeError): |
| 2956 | class R(BP, C, Protocol): |
| 2957 | pass |
| 2958 | |
| 2959 | class D(BP, C): pass |
| 2960 | |
| 2961 | class E(C, BP): pass |
| 2962 | |
| 2963 | self.assertNotIsInstance(D(), E) |
| 2964 | self.assertNotIsInstance(E(), D) |
| 2965 | |
| 2966 | def test_inheritance_from_object(self): |
| 2967 | # Inheritance from object is specifically allowed, unlike other nominal classes |
nothing calls this directly
no test coverage detected