Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed May 2, 2023
1 parent d88bb33 commit 76e5022
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -5224,10 +5224,10 @@ x: TD
x1 = TD({'x': []})
y: NM
y1 = NM(x=[])
reveal_type(x) # N: Revealed type is "TypedDict('__main__.TD', {'x': builtins.list[Any]})"
reveal_type(x1) # N: Revealed type is "TypedDict('__main__.TD', {'x': builtins.list[Any]})"
reveal_type(y) # N: Revealed type is "Tuple[builtins.list[Any], fallback=__main__.NM]"
reveal_type(y1) # N: Revealed type is "Tuple[builtins.list[Any], fallback=__main__.NM]"
reveal_type(x) # N: Revealed type is "TypedDict('__main__.TD', {'x': builtins.list[builtins.int]})"
reveal_type(x1) # N: Revealed type is "TypedDict('__main__.TD', {'x': builtins.list[builtins.int]})"
reveal_type(y) # N: Revealed type is "Tuple[builtins.list[builtins.int], fallback=__main__.NM]"
reveal_type(y1) # N: Revealed type is "Tuple[builtins.list[builtins.int], fallback=__main__.NM]"
[builtins fixtures/dict.pyi]
[out]

Expand Down
3 changes: 2 additions & 1 deletion test-data/unit/check-errorcodes.test
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ class E(Generic[S, T]): pass

x: C[object] # E: Value of type variable "T" of "C" cannot be "object" [type-var]
y: D[int] # E: Type argument "int" of "D" must be a subtype of "str" [type-var]
z: D[int, int] # E: "D" expects 1 type argument, but 2 given [type-arg]
z: D[int, int] # E: "D" expects 1 type argument, but 2 given [type-arg] \
# E: Type argument "int" of "D" must be a subtype of "str" [type-var]

def h(a: TT, s: S) -> None:
b: C[TT] # E: Invalid type argument value for "C" [type-var]
Expand Down
6 changes: 3 additions & 3 deletions test-data/unit/check-newsemanal.test
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ c2: C[int, str] # E: "C" expects 1 type argument, but 2 given
c3: C
c = C('') # E: Argument 1 to "C" has incompatible type "str"; expected "int"
reveal_type(c.get()) # N: Revealed type is "builtins.int"
reveal_type(c2) # N: Revealed type is "__main__.C[Any]"
reveal_type(c2) # N: Revealed type is "__main__.C[builtins.int]"
reveal_type(c3) # N: Revealed type is "__main__.C[Any]"
[case testNewAnalyzerGenericsTypeVarForwardRef]
from typing import TypeVar, Generic
Expand Down Expand Up @@ -1817,8 +1817,8 @@ def func(x: List[C[T]]) -> T:
x: A
A = List[C[int, str]] # E: "C" expects 1 type argument, but 2 given

reveal_type(x) # N: Revealed type is "builtins.list[__main__.C[Any]]"
reveal_type(func(x)) # N: Revealed type is "Any"
reveal_type(x) # N: Revealed type is "builtins.list[__main__.C[builtins.int]]"
reveal_type(func(x)) # N: Revealed type is "builtins.int"


[builtins fixtures/list.pyi]
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/check-type-aliases.test
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,8 @@ A = List[int, str] | int # E: "list" expects 1 type argument, but 2 given
B = int | list[int, str] # E: "list" expects 1 type argument, but 2 given
a: A
b: B
reveal_type(a) # N: Revealed type is "Union[builtins.list[Any], builtins.int]"
reveal_type(b) # N: Revealed type is "Union[builtins.int, builtins.list[Any]]"
reveal_type(a) # N: Revealed type is "Union[builtins.list[builtins.int], builtins.int]"
reveal_type(b) # N: Revealed type is "Union[builtins.int, builtins.list[builtins.int]]"

[case testValidTypeAliasValues]
from typing import TypeVar, Generic, List
Expand Down

0 comments on commit 76e5022

Please sign in to comment.