MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_one_success

Method test_one_success

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

Source from the content-addressed store, hash-verified

1395 )
1396 @async_test
1397 async def test_one_success(self, async_engine, filter_):
1398 users = self.tables.users
1399 async with async_engine.connect() as conn:
1400 result = await conn.stream(
1401 select(users).limit(1).order_by(users.c.user_name)
1402 )
1403
1404 if filter_ == "mappings":
1405 result = result.mappings()
1406 elif filter_ == "scalars":
1407 result = result.scalars()
1408 u1 = await result.one()
1409
1410 if filter_ == "mappings":
1411 eq_(u1, {"user_id": 1, "user_name": "name%d" % 1})
1412 elif filter_ == "scalars":
1413 eq_(u1, 1)
1414 else:
1415 eq_(u1, (1, "name%d" % 1))
1416
1417 @async_test
1418 async def test_one_no_result(self, async_engine):

Callers

nothing calls this directly

Calls 9

selectFunction · 0.90
eq_Function · 0.90
connectMethod · 0.45
streamMethod · 0.45
order_byMethod · 0.45
limitMethod · 0.45
mappingsMethod · 0.45
scalarsMethod · 0.45
oneMethod · 0.45

Tested by

no test coverage detected