File: check-python39.test

package info (click to toggle)
mypy 1.19.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,412 kB
  • sloc: python: 114,754; ansic: 13,343; cpp: 11,380; makefile: 257; sh: 28
file content (25 lines) | stat: -rw-r--r-- 872 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[case testGivingSameKeywordArgumentTwice]
# This test was originally in check-kwargs.test
# Python 3.9's new parser started producing a different error message here. Since this isn't the
# most important test, to deal with this we'll only run this test with Python 3.9 and later.
import typing
def f(a: 'A', b: 'B') -> None: pass
class A: pass
class B: pass
f(a=A(), b=B(), a=A()) # E: "f" gets multiple values for keyword argument "a"


[case testPEP614]
from typing import Callable, List

decorator_list: List[Callable[..., Callable[[int], str]]]
@decorator_list[0]
def f(x: float) -> float: ...
reveal_type(f)  # N: Revealed type is "def (builtins.int) -> builtins.str"
[builtins fixtures/list.pyi]

[case testStarredExpressionsInForLoop]
a = b = c = [1, 2, 3]
for x in *a, *b, *c:
    reveal_type(x)  # N: Revealed type is "builtins.int"
[builtins fixtures/tuple.pyi]