-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
184 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
-e .[testutil] | ||
# astroid dependency is also defined in setup.cfg | ||
astroid==2.9.3 # Pinned to a specific version for tests | ||
typing-extensions~=4.0 | ||
pytest~=7.0 | ||
pytest-benchmark~=3.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
'typing.NoReturn' is broken inside compond types for Python 3.7.0 | ||
https://bugs.python.org/issue34921 | ||
If no runtime introspection is required, use string annotations instead. | ||
""" | ||
# pylint: disable=missing-docstring | ||
import typing | ||
from typing import Callable, NoReturn, Union | ||
|
||
import typing_extensions | ||
|
||
|
||
def func1() -> NoReturn: | ||
raise Exception | ||
|
||
def func2() -> Union[None, NoReturn]: # [broken-noreturn] | ||
pass | ||
|
||
def func3() -> Union[None, "NoReturn"]: | ||
pass | ||
|
||
def func4() -> Union[None, typing.NoReturn]: # [broken-noreturn] | ||
pass | ||
|
||
def func5() -> Union[None, typing_extensions.NoReturn]: # [broken-noreturn] | ||
pass | ||
|
||
|
||
Alias1 = NoReturn | ||
Alias2 = Callable[..., NoReturn] # [broken-noreturn] | ||
Alias3 = Callable[..., "NoReturn"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[master] | ||
py-version=3.7 | ||
load-plugins=pylint.extensions.typing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
broken-noreturn:17:27:17:35:func2:'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:INFERENCE | ||
broken-noreturn:23:27:23:42:func4:'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:INFERENCE | ||
broken-noreturn:26:27:26:53:func5:'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:INFERENCE | ||
broken-noreturn:31:23:31:31::'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:INFERENCE |
37 changes: 37 additions & 0 deletions
37
tests/functional/ext/typing/typing_broken_noreturn_future_import.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
'typing.NoReturn' is broken inside compond types for Python 3.7.0 | ||
https://bugs.python.org/issue34921 | ||
If no runtime introspection is required, use string annotations instead. | ||
With 'from __future__ import annotations', only emit errors for nodes | ||
not in a type annotation context. | ||
""" | ||
# pylint: disable=missing-docstring | ||
from __future__ import annotations | ||
|
||
import typing | ||
from typing import Callable, NoReturn, Union | ||
|
||
import typing_extensions | ||
|
||
|
||
def func1() -> NoReturn: | ||
raise Exception | ||
|
||
def func2() -> Union[None, NoReturn]: | ||
pass | ||
|
||
def func3() -> Union[None, "NoReturn"]: | ||
pass | ||
|
||
def func4() -> Union[None, typing.NoReturn]: | ||
pass | ||
|
||
def func5() -> Union[None, typing_extensions.NoReturn]: | ||
pass | ||
|
||
|
||
Alias1 = NoReturn | ||
Alias2 = Callable[..., NoReturn] # [broken-noreturn] | ||
Alias3 = Callable[..., "NoReturn"] |
6 changes: 6 additions & 0 deletions
6
tests/functional/ext/typing/typing_broken_noreturn_future_import.rc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[master] | ||
py-version=3.7 | ||
load-plugins=pylint.extensions.typing | ||
|
||
[testoptions] | ||
min_pyver=3.7 |
1 change: 1 addition & 0 deletions
1
tests/functional/ext/typing/typing_broken_noreturn_future_import.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
broken-noreturn:36:23:36:31::'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1:INFERENCE |
34 changes: 34 additions & 0 deletions
34
tests/functional/ext/typing/typing_broken_noreturn_py372.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
'typing.NoReturn' is broken inside compond types for Python 3.7.0 | ||
https://bugs.python.org/issue34921 | ||
If no runtime introspection is required, use string annotations instead. | ||
Don't emit errors if py-version set to >= 3.7.2. | ||
""" | ||
# pylint: disable=missing-docstring | ||
import typing | ||
from typing import Callable, NoReturn, Union | ||
|
||
import typing_extensions | ||
|
||
|
||
def func1() -> NoReturn: | ||
raise Exception | ||
|
||
def func2() -> Union[None, NoReturn]: | ||
pass | ||
|
||
def func3() -> Union[None, "NoReturn"]: | ||
pass | ||
|
||
def func4() -> Union[None, typing.NoReturn]: | ||
pass | ||
|
||
def func5() -> Union[None, typing_extensions.NoReturn]: | ||
pass | ||
|
||
|
||
Alias1 = NoReturn | ||
Alias2 = Callable[..., NoReturn] | ||
Alias3 = Callable[..., "NoReturn"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[master] | ||
py-version=3.7.2 | ||
load-plugins=pylint.extensions.typing |