MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_subprotocols_merging

Method test_subprotocols_merging

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected