MCPcopy Index your code
hub / github.com/python/cpython / test_subprotocols_extending

Method test_subprotocols_extending

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

Source from the content-addressed store, hash-verified

3054 self.assertIsInstance(C(), P)
3055
3056 def test_subprotocols_extending(self):
3057 class P1(Protocol):
3058 def meth1(self):
3059 pass
3060
3061 @runtime_checkable
3062 class P2(P1, Protocol):
3063 def meth2(self):
3064 pass
3065
3066 class C:
3067 def meth1(self):
3068 pass
3069
3070 def meth2(self):
3071 pass
3072
3073 class C1:
3074 def meth1(self):
3075 pass
3076
3077 class C2:
3078 def meth2(self):
3079 pass
3080
3081 self.assertNotIsInstance(C1(), P2)
3082 self.assertNotIsInstance(C2(), P2)
3083 self.assertNotIsSubclass(C1, P2)
3084 self.assertNotIsSubclass(C2, P2)
3085 self.assertIsInstance(C(), P2)
3086 self.assertIsSubclass(C, P2)
3087
3088 def test_subprotocols_merging(self):
3089 class P1(Protocol):

Callers

nothing calls this directly

Calls 7

assertNotIsInstanceMethod · 0.80
assertNotIsSubclassMethod · 0.80
assertIsInstanceMethod · 0.80
assertIsSubclassMethod · 0.80
C1Class · 0.70
C2Class · 0.70
CClass · 0.70

Tested by

no test coverage detected