"""The private _asyncio accessors, reached directly instead of through a loop. CPython's _asyncio rejects every call below with "loop ... is not the running loop" before it gets anywhere, and does not expose _current_tasks at all, so these only run where they are reachable. """ import sys from testutils import assert_raises if sys.implementation.name != "rustpython": sys.exit(0) import _asyncio def _task(): pass # The "already entered" message formats both tasks; a plain function used to be # formatted as the wrong type there. _asyncio._enter_task(0, _task) with assert_raises(RuntimeError) as cm: _asyncio._enter_task(0, _task) assert "Cannot enter into task" in str(cm.exception), cm.exception assert "