|
|
018433 |
From 240d811b00fb1cedfc42848e6efa6137bf009e8d Mon Sep 17 00:00:00 2001
|
|
|
018433 |
From: Fidget-Spinner <28750310+Fidget-Spinner@users.noreply.github.com>
|
|
|
018433 |
Date: Sat, 2 Jan 2021 23:26:26 +0800
|
|
|
018433 |
Subject: [PATCH] Update test_typing_extensions.py
|
|
|
018433 |
|
|
|
018433 |
---
|
|
|
018433 |
typing_extensions/src_py3/test_typing_extensions.py | 8 +++++---
|
|
|
018433 |
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
018433 |
|
|
|
018433 |
diff --git a/typing_extensions/src_py3/test_typing_extensions.py b/typing_extensions/src_py3/test_typing_extensions.py
|
|
|
018433 |
index b89b396..98d02a0 100644
|
|
|
018433 |
--- a/typing_extensions/src_py3/test_typing_extensions.py
|
|
|
018433 |
+++ b/typing_extensions/src_py3/test_typing_extensions.py
|
|
|
018433 |
@@ -51,6 +51,7 @@
|
|
|
018433 |
TYPING_3_5_1 = TYPING_LATEST or sys.version_info[:3] >= (3, 5, 1)
|
|
|
018433 |
TYPING_3_5_3 = TYPING_LATEST or sys.version_info[:3] >= (3, 5, 3)
|
|
|
018433 |
TYPING_3_6_1 = TYPING_LATEST or sys.version_info[:3] >= (3, 6, 1)
|
|
|
018433 |
+TYPING_3_10_0 = TYPING_LATEST or sys.version_info[:3] >= (3, 10, 0)
|
|
|
018433 |
|
|
|
018433 |
# For typing versions where issubclass(...) and
|
|
|
018433 |
# isinstance(...) checks are forbidden.
|
|
|
018433 |
@@ -1240,8 +1241,9 @@ class P(PR[int, str], Protocol):
|
|
|
018433 |
self.assertIsSubclass(P, PR)
|
|
|
018433 |
with self.assertRaises(TypeError):
|
|
|
018433 |
PR[int]
|
|
|
018433 |
- with self.assertRaises(TypeError):
|
|
|
018433 |
- PR[int, 1]
|
|
|
018433 |
+ if not TYPING_3_10_0:
|
|
|
018433 |
+ with self.assertRaises(TypeError):
|
|
|
018433 |
+ PR[int, 1]
|
|
|
018433 |
class P1(Protocol, Generic[T]):
|
|
|
018433 |
def bar(self, x: T) -> str: ...
|
|
|
018433 |
class P2(Generic[T], Protocol):
|
|
|
018433 |
@@ -1254,7 +1256,7 @@ class Test:
|
|
|
018433 |
def bar(self, x: str) -> str:
|
|
|
018433 |
return x
|
|
|
018433 |
self.assertIsInstance(Test(), PSub)
|
|
|
018433 |
- if TYPING_3_5_3:
|
|
|
018433 |
+ if TYPING_3_5_3 and not TYPING_3_10_0:
|
|
|
018433 |
with self.assertRaises(TypeError):
|
|
|
018433 |
PR[int, ClassVar]
|
|
|
018433 |
|