diff options
Diffstat (limited to 'test/ext/asyncio/test_engine_py3k.py')
-rw-r--r-- | test/ext/asyncio/test_engine_py3k.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ext/asyncio/test_engine_py3k.py b/test/ext/asyncio/test_engine_py3k.py index 0fdbc28df..1f40cbdec 100644 --- a/test/ext/asyncio/test_engine_py3k.py +++ b/test/ext/asyncio/test_engine_py3k.py @@ -18,6 +18,7 @@ from sqlalchemy import union_all from sqlalchemy.ext.asyncio import async_engine_from_config from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.ext.asyncio import engine as _async_engine +from sqlalchemy.ext.asyncio import exc as async_exc from sqlalchemy.ext.asyncio import exc as asyncio_exc from sqlalchemy.ext.asyncio.base import ReversibleProxy from sqlalchemy.ext.asyncio.engine import AsyncConnection @@ -724,6 +725,32 @@ class AsyncInspection(EngineFixture): class AsyncResultTest(EngineFixture): + @async_test + async def test_no_ss_cursor_w_execute(self, async_engine): + users = self.tables.users + async with async_engine.connect() as conn: + conn = await conn.execution_options(stream_results=True) + with expect_raises_message( + async_exc.AsyncMethodRequired, + r"Can't use the AsyncConnection.execute\(\) method with a " + r"server-side cursor. Use the AsyncConnection.stream\(\) " + r"method for an async streaming result set.", + ): + await conn.execute(select(users)) + + @async_test + async def test_no_ss_cursor_w_exec_driver_sql(self, async_engine): + async with async_engine.connect() as conn: + conn = await conn.execution_options(stream_results=True) + with expect_raises_message( + async_exc.AsyncMethodRequired, + r"Can't use the AsyncConnection.exec_driver_sql\(\) " + r"method with a " + r"server-side cursor. Use the AsyncConnection.stream\(\) " + r"method for an async streaming result set.", + ): + await conn.exec_driver_sql("SELECT * FROM users") + @testing.combinations( (None,), ("scalars",), ("mappings",), argnames="filter_" ) |