| 1 |
[case testEmptyFile] |
| 2 |
[out] |
| 3 |
-- Note that builtins are ignored to simplify output. |
| 4 |
__main__: |
| 5 |
SymbolTable() |
| 6 |
|
| 7 |
[case testVarDef] |
| 8 |
x = 1 |
| 9 |
[out] |
| 10 |
__main__: |
| 11 |
SymbolTable( |
| 12 |
x : Gdef/Var (__main__.x) : int) |
| 13 |
|
| 14 |
[case testFuncDef] |
| 15 |
def f(): pass |
| 16 |
[out] |
| 17 |
__main__: |
| 18 |
SymbolTable( |
| 19 |
f : Gdef/FuncDef (__main__.f)) |
| 20 |
|
| 21 |
[case testEmptyClassDef] |
| 22 |
class c: pass |
| 23 |
[out] |
| 24 |
__main__: |
| 25 |
SymbolTable( |
| 26 |
c : Gdef/TypeInfo (__main__.c)) |
| 27 |
|
| 28 |
[case testImport] |
| 29 |
import m |
| 30 |
[file m.py] |
| 31 |
x = 1 |
| 32 |
[out] |
| 33 |
__main__: |
| 34 |
SymbolTable( |
| 35 |
m : Gdef/MypyFile (m)) |
| 36 |
m: |
| 37 |
SymbolTable( |
| 38 |
x : Gdef/Var (m.x) : int) |
| 39 |
|
| 40 |
[case testImportFromModule] |
| 41 |
from m import x |
| 42 |
[file m.py] |
| 43 |
class x: pass |
| 44 |
y = 1 |
| 45 |
[out] |
| 46 |
__main__: |
| 47 |
SymbolTable( |
| 48 |
x : Gdef/TypeInfo (m.x)) |
| 49 |
m: |
| 50 |
SymbolTable( |
| 51 |
x : Gdef/TypeInfo (m.x) |
| 52 |
y : Gdef/Var (m.y) : int) |
| 53 |
|
| 54 |
[case testImportAs] |
| 55 |
from m import x as xx |
| 56 |
[file m.py] |
| 57 |
class x: pass |
| 58 |
y = 1 |
| 59 |
[out] |
| 60 |
__main__: |
| 61 |
SymbolTable( |
| 62 |
xx : Gdef/TypeInfo (m.x)) |
| 63 |
m: |
| 64 |
SymbolTable( |
| 65 |
x : Gdef/TypeInfo (m.x) |
| 66 |
y : Gdef/Var (m.y) : int) |
| 67 |
|
| 68 |
[case testFailingImports] |
| 69 |
from sys import non_existing1 # type: ignore |
| 70 |
from xyz import non_existing2 # type: ignore |
| 71 |
if int(): |
| 72 |
from sys import non_existing3 # type: ignore |
| 73 |
import non_existing4 # type: ignore |
| 74 |
[out] |
| 75 |
__main__: |
| 76 |
SymbolTable( |
| 77 |
non_existing1 : Gdef/Var (__main__.non_existing1) : Any |
| 78 |
non_existing2 : Gdef/Var (__main__.non_existing2) : Any |
| 79 |
non_existing3 : Gdef/Var (__main__.non_existing3) : Any |
| 80 |
non_existing4 : Gdef/Var (__main__.non_existing4) : Any) |
| 81 |
|
| 82 |
[case testDecorator] |
| 83 |
from typing import Callable |
| 84 |
|
| 85 |
def dec(f: Callable[[], None]) -> Callable[[], None]: |
| 86 |
return f |
| 87 |
|
| 88 |
@dec |
| 89 |
def g() -> None: |
| 90 |
pass |
| 91 |
[out] |
| 92 |
__main__: |
| 93 |
SymbolTable( |
| 94 |
Callable : Gdef/Var (typing.Callable) : int |
| 95 |
dec : Gdef/FuncDef (__main__.dec) : def (f: def ()) -> def () |
| 96 |
g : Gdef/Decorator (__main__.g) : def ()) |