You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
364 B
23 lines
364 B
4 years ago
|
# Test current_task() function
|
||
|
|
||
|
try:
|
||
1 year ago
|
import asyncio
|
||
4 years ago
|
except ImportError:
|
||
1 year ago
|
print("SKIP")
|
||
|
raise SystemExit
|
||
4 years ago
|
|
||
|
|
||
|
async def task(result):
|
||
|
result[0] = asyncio.current_task()
|
||
|
|
||
|
|
||
|
async def main():
|
||
|
result = [None]
|
||
|
t = asyncio.create_task(task(result))
|
||
|
await asyncio.sleep(0)
|
||
|
await asyncio.sleep(0)
|
||
|
print(t is result[0])
|
||
|
|
||
|
|
||
|
asyncio.run(main())
|