mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-38908: Fix issue when non runtime_protocol failed to raise TypeError (#26067)
This commit is contained in:
parent
9b06e4b535
commit
c40486a32d
3 changed files with 23 additions and 2 deletions
|
@ -1422,6 +1422,14 @@ class ProtocolTests(BaseTestCase):
|
|||
class CustomContextManager(typing.ContextManager, Protocol):
|
||||
pass
|
||||
|
||||
def test_non_runtime_protocol_isinstance_check(self):
|
||||
class P(Protocol):
|
||||
x: int
|
||||
|
||||
with self.assertRaisesRegex(TypeError, "@runtime_checkable"):
|
||||
isinstance(1, P)
|
||||
|
||||
|
||||
class GenericTests(BaseTestCase):
|
||||
|
||||
def test_basics(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue