File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ def separate_namespaces(tree):
177
177
nodes = []
178
178
body = []
179
179
for el in tree .body :
180
- if type (el ) == ast .FunctionDef :
180
+ if type (el ) in ( ast .FunctionDef , ast . AsyncFunctionDef ) :
181
181
nodes .append (el )
182
182
elif type (el ) == ast .ClassDef :
183
183
groups .append (el )
Original file line number Diff line number Diff line change
1
+ import asyncio
2
+
3
+ class A :
4
+ def __init__ (self ):
5
+ pass
6
+ async def test (self ):
7
+ print ("hello world" )
8
+
9
+ async def main ():
10
+ a = A ()
11
+ await a .test ()
12
+
13
+ asyncio .run (main ())
Original file line number Diff line number Diff line change 241
241
"expected_edges" : [],
242
242
"expected_nodes" : ["file_b::(global)" , "file_b::b" , "file_b::c" ]
243
243
},
244
+ {
245
+ "test_name" : "async_basic" ,
246
+ "directory" : "async_basic" ,
247
+ "kwargs" : {},
248
+ "expected_edges" : [["async_basic::main" , "async_basic::A.__init__" ],
249
+ ["async_basic::(global)" , "async_basic::main" ],
250
+ ["async_basic::main" , "async_basic::A.test" ]],
251
+ "expected_nodes" : ["async_basic::(global)" ,
252
+ "async_basic::A.__init__" ,
253
+ "async_basic::A.test" ,
254
+ "async_basic::main" ]
255
+ },
244
256
{
245
257
"test_name" : "exclude_modules" ,
246
258
"comment" : "Correct name resolution when third-party modules are involved" ,
You can’t perform that action at this time.
0 commit comments