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

Method test_subprotocols_merging

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

Source from the content-addressed store, hash-verified

3086 self.assertIsSubclass(C, P2)
3087
3088 def test_subprotocols_merging(self):
3089 class P1(Protocol):
3090 def meth1(self):
3091 pass
3092
3093 class P2(Protocol):
3094 def meth2(self):
3095 pass
3096
3097 @runtime_checkable
3098 class P(P1, P2, Protocol):
3099 pass
3100
3101 class C:
3102 def meth1(self):
3103 pass
3104
3105 def meth2(self):
3106 pass
3107
3108 class C1:
3109 def meth1(self):
3110 pass
3111
3112 class C2:
3113 def meth2(self):
3114 pass
3115
3116 self.assertNotIsInstance(C1(), P)
3117 self.assertNotIsInstance(C2(), P)
3118 self.assertNotIsSubclass(C1, P)
3119 self.assertNotIsSubclass(C2, P)
3120 self.assertIsInstance(C(), P)
3121 self.assertIsSubclass(C, P)
3122
3123 def test_protocols_issubclass(self):
3124 T = TypeVar('T')

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