Skip to content
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

Correctly recognize typing_extensions.NewType #16298

Merged
merged 2 commits into from
Oct 20, 2023
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
Test for typing_extensions.NewType support
  • Loading branch information
gschaffner committed Oct 19, 2023
commit 1f20d68d268985d0c68c4e186820d6007233735c
7 changes: 7 additions & 0 deletions test-data/unit/check-newtype.test
Original file line number Diff line number Diff line change
Expand Up @@ -379,3 +379,10 @@ N = NewType('N', XXX) # E: Argument 2 to NewType(...) must be subclassable (got
# E: Name "XXX" is not defined
x: List[Union[N, int]]
[builtins fixtures/list.pyi]

[case testTypingExtensionsNewType]
# flags: --python-version 3.7
from typing_extensions import NewType
N = NewType("N", int)
x: N
[builtins fixtures/tuple.pyi]