diff options
| author | Jim Mussared <jim.mussared@gmail.com> | 2023-06-08 16:01:38 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-06-19 17:33:03 +1000 |
| commit | 6027c41c8f5b8f1a9e7b85b2bb93b3e6f2718e54 (patch) | |
| tree | 08f41a4d0cd48fa5c0bc49519832ac2faba6923a /tests/extmod/uasyncio_task_done.py | |
| parent | 2fbc08c462e247e7f78460783c9a07c76c5b762e (diff) | |
tests: Rename uasyncio to asyncio.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tests/extmod/uasyncio_task_done.py')
| -rw-r--r-- | tests/extmod/uasyncio_task_done.py | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/extmod/uasyncio_task_done.py b/tests/extmod/uasyncio_task_done.py deleted file mode 100644 index 2700da8c3..000000000 --- a/tests/extmod/uasyncio_task_done.py +++ /dev/null @@ -1,66 +0,0 @@ -# Test the Task.done() method - -try: - import uasyncio as asyncio -except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit - - -async def task(t, exc=None): - print("task start") - if t >= 0: - await asyncio.sleep(t) - if exc: - raise exc - print("task done") - - -async def main(): - # Task that finishes immediately. - print("=" * 10) - t = asyncio.create_task(task(-1)) - print(t.done()) - await asyncio.sleep(0) - print(t.done()) - await t - print(t.done()) - - # Task that starts, runs and finishes. - print("=" * 10) - t = asyncio.create_task(task(0.01)) - print(t.done()) - await asyncio.sleep(0) - print(t.done()) - await t - print(t.done()) - - # Task that raises immediately. - print("=" * 10) - t = asyncio.create_task(task(-1, ValueError)) - print(t.done()) - await asyncio.sleep(0) - print(t.done()) - try: - await t - except ValueError as er: - print(repr(er)) - print(t.done()) - - # Task that raises after a delay. - print("=" * 10) - t = asyncio.create_task(task(0.01, ValueError)) - print(t.done()) - await asyncio.sleep(0) - print(t.done()) - try: - await t - except ValueError as er: - print(repr(er)) - print(t.done()) - - -asyncio.run(main()) |
