MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_stream_ctxmanager

Method test_stream_ctxmanager

test/ext/asyncio/test_engine.py:1173–1187  ·  view source on GitHub ↗
(self, async_engine)

Source from the content-addressed store, hash-verified

1171
1172 @async_test
1173 async def test_stream_ctxmanager(self, async_engine):
1174 async with async_engine.connect() as conn:
1175 conn = await conn.execution_options(stream_results=True)
1176
1177 async with conn.stream(select(self.tables.users)) as result:
1178 assert not result._real_result._soft_closed
1179 assert not result.closed
1180 with expect_raises_message(Exception, "hi"):
1181 i = 0
1182 async for row in result:
1183 if i > 2:
1184 raise Exception("hi")
1185 i += 1
1186 assert result._real_result._soft_closed
1187 assert result.closed
1188
1189 @async_test
1190 async def test_stream_scalars_ctxmanager(self, async_engine):

Callers

nothing calls this directly

Calls 5

selectFunction · 0.90
expect_raises_messageFunction · 0.90
connectMethod · 0.45
execution_optionsMethod · 0.45
streamMethod · 0.45

Tested by

no test coverage detected