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

Method test_subprotocols_extending

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

Source from the content-addressed store, hash-verified

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

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