mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
bpo-38908: Fix issue when non runtime_protocol failed to raise TypeError (GH-26067)
(cherry picked from commit c40486a32d
)
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
This commit is contained in:
parent
bd5dfd6c8c
commit
a2d94a0a9b
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