Skip to content

Commit 59d8550

Browse files
committed
Add tests
1 parent 919045f commit 59d8550

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

test-data/unit/exportjson.test

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,95 @@ class C:
118118
"future_import_flags": []
119119
}
120120

121+
[case testExportCrossRef]
122+
from typing import Any
123+
[out]
124+
{
125+
".class": "MypyFile",
126+
"_fullname": "main",
127+
"names": {
128+
".class": "SymbolTable",
129+
"Any": {
130+
".class": "SymbolTableNode",
131+
"kind": "Gdef",
132+
"cross_ref": "typing.Any"
133+
}
134+
},
135+
"is_stub": false,
136+
"path": ...,
137+
"is_partial_stub_package": false,
138+
"future_import_flags": []
139+
}
140+
141+
[case testExportFuncDef]
142+
def foo(a: int) -> None: ...
143+
[out]
144+
{
145+
".class": "MypyFile",
146+
"_fullname": "main",
147+
"names": {
148+
".class": "SymbolTable",
149+
"foo": {
150+
".class": "SymbolTableNode",
151+
"kind": "Gdef",
152+
"node": {
153+
".class": "FuncDef",
154+
"name": "foo",
155+
"fullname": "main.foo",
156+
"arg_names": [
157+
"a"
158+
],
159+
"arg_kinds": [
160+
0
161+
],
162+
"type": {
163+
".class": "CallableType",
164+
"arg_types": [
165+
{
166+
".class": "Instance",
167+
"type_ref": null,
168+
"args": []
169+
}
170+
],
171+
"arg_kinds": [
172+
0
173+
],
174+
"arg_names": [
175+
"a"
176+
],
177+
"ret_type": {
178+
".class": "NoneType"
179+
},
180+
"fallback": {
181+
".class": "Instance",
182+
"type_ref": null,
183+
"args": []
184+
},
185+
"name": "foo",
186+
"variables": [],
187+
"is_ellipsis_args": false,
188+
"implicit": false,
189+
"is_bound": false,
190+
"type_guard": null,
191+
"type_is": null,
192+
"from_concatenate": false,
193+
"imprecise_arg_kinds": false,
194+
"unpack_kwargs": false
195+
},
196+
"flags": [],
197+
"abstract_status": 0,
198+
"dataclass_transform_spec": null,
199+
"deprecated": null,
200+
"original_first_arg": "a"
201+
}
202+
}
203+
},
204+
"is_stub": false,
205+
"path": ...,
206+
"is_partial_stub_package": false,
207+
"future_import_flags": []
208+
}
209+
121210
[case testExportDifferentTypes]
122211
from __future__ import annotations
123212

0 commit comments

Comments
 (0)