Skip to content

Commit

Permalink
Update test_typing_extensions.py (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner authored Jan 2, 2021
1 parent b5c0b6d commit c7a981a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions typing_extensions/src_py3/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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):
Expand All @@ -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]

Expand Down

0 comments on commit c7a981a

Please sign in to comment.