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

Method test_optional_issubclass

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

Source from the content-addressed store, hash-verified

2076 issubclass(int, Union[list[int], str])
2077
2078 def test_optional_issubclass(self):
2079 self.assertIsSubclass(int, Optional[int])
2080 self.assertIsSubclass(type(None), Optional[int])
2081 self.assertNotIsSubclass(str, Optional[int])
2082 self.assertIsSubclass(Any, Optional[Any])
2083 self.assertIsSubclass(type(None), Optional[Any])
2084 self.assertNotIsSubclass(int, Optional[Any])
2085
2086 def test_optional_issubclass_type_error(self):
2087 with self.assertRaises(TypeError):

Callers

nothing calls this directly

Calls 2

assertIsSubclassMethod · 0.80
assertNotIsSubclassMethod · 0.80

Tested by

no test coverage detected