Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Jul 14, 2023
1 parent 3c629f4 commit a9d34ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions test-data/unit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ feature you added. If you added a new `check-*.test` file, it will be autodiscov
Add the test in this format anywhere in the file:

[case testNewSyntaxBasics]
# flags: --python-version 3.10
x: int
x = 5
y: int = 5
Expand Down
7 changes: 5 additions & 2 deletions test-data/unit/check-union-or-syntax.test
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ x: List[int | str]
reveal_type(x) # N: Revealed type is "builtins.list[Union[builtins.int, builtins.str]]"
[builtins fixtures/list.pyi]

[case testUnionOrSyntaxWithQuotedFunctionTypes]
[case testUnionOrSyntaxWithQuotedFunctionTypesPre310]
# flags: --python-version 3.9
from typing import Union
def f(x: 'Union[int, str, None]') -> 'Union[int, None]':
reveal_type(x) # N: Revealed type is "Union[builtins.int, builtins.str, None]"
Expand All @@ -78,7 +79,8 @@ def g(x: "int | str | None") -> "int | None":
return 42
reveal_type(g) # N: Revealed type is "def (x: Union[builtins.int, builtins.str, None]) -> Union[builtins.int, None]"

[case testUnionOrSyntaxWithQuotedVariableTypes]
[case testUnionOrSyntaxWithQuotedVariableTypesPre310]
# flags: --python-version 3.9
y: "int | str" = 42
reveal_type(y) # N: Revealed type is "Union[builtins.int, builtins.str]"

Expand Down Expand Up @@ -135,6 +137,7 @@ x: int | None
x: int | None # E: X | Y syntax for unions requires Python 3.10

[case testUnionOrSyntaxInStubFile]
# flags: --python-version 3.9
from lib import x
[file lib.pyi]
x: int | None
Expand Down

0 comments on commit a9d34ea

Please sign in to comment.