8000 Support PEP 612 in typing_extensions (Python 3) by Fidget-Spinner · Pull Request #774 · python/typing · GitHub
[go: up one dir, main page]

Skip to content

Support PEP 612 in typing_extensions (Python 3) #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update test_typing_extensions.py
  • Loading branch information
Fidget-Spinner committed Jan 2, 2021
commit 240d811b00fb1cedfc42848e6efa6137bf009e8d
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