summaryrefslogtreecommitdiff
path: root/tests/functional
diff options
context:
space:
mode:
authorYilei "Dolee" Yang <yileiyang@google.com>2023-04-07 00:16:29 -0700
committerGitHub <noreply@github.com>2023-04-07 07:16:29 +0000
commitcb255eaaed8bba6bec1f7bf5d4cde15821c1dd46 (patch)
treedfc919cdd22f126f5b5e03f9a780d2722168cc8e /tests/functional
parenteeddd667a6e73ef58fb47cdda154c1751f0ffe71 (diff)
downloadpylint-git-cb255eaaed8bba6bec1f7bf5d4cde15821c1dd46.tar.gz
Fix typelias `invalid-name` false positives for Union variables without assignment. (#8541)
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/t/typealias_naming_style_default.py5
-rw-r--r--tests/functional/t/typealias_naming_style_rgx.py4
2 files changed, 6 insertions, 3 deletions
diff --git a/tests/functional/t/typealias_naming_style_default.py b/tests/functional/t/typealias_naming_style_default.py
index 6b27c14a0..8baabb49c 100644
--- a/tests/functional/t/typealias_naming_style_default.py
+++ b/tests/functional/t/typealias_naming_style_default.py
@@ -26,5 +26,8 @@ _1BadName = Union[int, str] # [invalid-name]
ANOTHERBADNAME = Union[int, str] # [invalid-name]
# Regression tests
-# This is not a TypeAlias, and thus shouldn't flag the message
+# They are not TypeAlias, and thus shouldn't flag the message
x: Union[str, int] = 42
+y: Union[str, int]
+# But the following, using a good TypeAlias name, is:
+GoodTypeAliasToUnion: TypeAlias = Union[str, int]
diff --git a/tests/functional/t/typealias_naming_style_rgx.py b/tests/functional/t/typealias_naming_style_rgx.py
index 0910644da..bc43b930d 100644
--- a/tests/functional/t/typealias_naming_style_rgx.py
+++ b/tests/functional/t/typealias_naming_style_rgx.py
@@ -3,8 +3,8 @@ from typing import TypeAlias, Union
# Valid
TypeAliasShouldBeLikeThis: TypeAlias = int
-_TypeAliasShouldBeLikeThis: Union[str, int]
+_TypeAliasShouldBeLikeThis = Union[str, int]
# Invalid
TypeAliasShouldntBeLikeThis: TypeAlias = int # [invalid-name]
-_TypeAliasShouldntBeLikeThis: Union[str, int] # [invalid-name]
+_TypeAliasShouldntBeLikeThis = Union[str, int] # [invalid-name]