| 1 |
[case testLiteralSemanalBasicAssignment] |
| 2 |
from typing import Literal |
| 3 |
foo: Literal[3] |
| 4 |
[out] |
| 5 |
MypyFile:1( |
| 6 |
ImportFrom:1(typing, [Literal]) |
| 7 |
AssignmentStmt:2( |
| 8 |
NameExpr(foo [__main__.foo]) |
| 9 |
TempNode:2( |
| 10 |
Any) |
| 11 |
Literal[3])) |
| 12 |
|
| 13 |
[case testLiteralSemanalInFunction] |
| 14 |
from typing import Literal |
| 15 |
def foo(a: Literal[1], b: Literal[" foo "]) -> Literal[True]: pass |
| 16 |
[builtins fixtures/bool.pyi] |
| 17 |
[out] |
| 18 |
MypyFile:1( |
| 19 |
ImportFrom:1(typing, [Literal]) |
| 20 |
FuncDef:2( |
| 21 |
foo |
| 22 |
Args( |
| 23 |
Var(a) |
| 24 |
Var(b)) |
| 25 |
def (a: Literal[1], b: Literal[' foo ']) -> Literal[True] |
| 26 |
Block:2( |
| 27 |
PassStmt:2()))) |