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