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

Method test_runtime_checkable_generic

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

Source from the content-addressed store, hash-verified

2887 class Foo[T]: ...
2888
2889 def test_runtime_checkable_generic(self):
2890 @runtime_checkable
2891 class Foo[T](Protocol):
2892 def meth(self) -> T: ...
2893
2894 class Impl:
2895 def meth(self) -> int: ...
2896
2897 self.assertIsSubclass(Impl, Foo)
2898
2899 class NotImpl:
2900 def method(self) -> int: ...
2901
2902 self.assertNotIsSubclass(NotImpl, Foo)
2903
2904 def test_pep695_generics_can_be_runtime_checkable(self):
2905 @runtime_checkable

Callers

nothing calls this directly

Calls 2

assertIsSubclassMethod · 0.80
assertNotIsSubclassMethod · 0.80

Tested by

no test coverage detected