File tree Expand file tree Collapse file tree 2 files changed +27
-9
lines changed
python/ql/test/experimental/dataflow/coverage Expand file tree Collapse file tree 2 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -1253,17 +1253,17 @@ def test_exit():
1253
1253
with With_exit ():
1254
1254
pass
1255
1255
1256
- # # 3.4.1. Awaitable Objects
1257
- # # object.__await__(self)
1258
- # class With_await:
1256
+ # 3.4.1. Awaitable Objects
1257
+ # object.__await__(self)
1258
+ class With_await :
1259
1259
1260
- # def __await__(self):
1261
- # OK()
1262
- # return "" # edit to match type
1260
+ def __await__ (self ):
1261
+ OK ()
1262
+ return ( yield from asyncio . coroutine ( lambda : "" )())
1263
1263
1264
- # async def test_await ():
1265
- # with_await = With_await()
1266
- # await(with_await) # edit to effect call
1264
+ async def atest_await ():
1265
+ with_await = With_await ()
1266
+ await (with_await )
1267
1267
1268
1268
1269
1269
# # 3.4.2. Coroutine Objects
Original file line number Diff line number Diff line change @@ -15,6 +15,18 @@ def check_test_function(f):
15
15
sys .stdout = old_stdout
16
16
check_output (capturer .getvalue (), f )
17
17
18
+ def check_async_test_function (f ):
19
+ from io import StringIO
20
+ import sys
21
+ import asyncio
22
+
23
+ capturer = StringIO ()
24
+ old_stdout = sys .stdout
25
+ sys .stdout = capturer
26
+ asyncio .run (f ())
27
+ sys .stdout = old_stdout
28
+ check_output (capturer .getvalue (), f )
29
+
18
30
def check_classes_valid (testFile ):
19
31
# import python.ql.test.experimental.dataflow.coverage.classes as tests
20
32
# import classes as tests
@@ -28,6 +40,12 @@ def check_classes_valid(testFile):
28
40
print ("Checking" , testFile , item )
29
41
check_test_function (item )
30
42
43
+ elif i .startswith ("atest_" ):
44
+ item = getattr (tests ,i )
45
+ if callable (item ):
46
+ print ("Checking" , testFile , item )
47
+ check_async_test_function (item )
48
+
31
49
if __name__ == '__main__' :
32
50
check_classes_valid ("classes" )
33
51
check_classes_valid ("test" )
You can’t perform that action at this time.
0 commit comments