MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_one_success

Method test_one_success

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

Source from the content-addressed store, hash-verified

1324 )
1325 @async_test
1326 async def test_one_success(self, async_engine, filter_):
1327 users = self.tables.users
1328 async with async_engine.connect() as conn:
1329 result = await conn.stream(
1330 select(users).limit(1).order_by(users.c.user_name)
1331 )
1332
1333 if filter_ == "mappings":
1334 result = result.mappings()
1335 elif filter_ == "scalars":
1336 result = result.scalars()
1337 u1 = await result.one()
1338
1339 if filter_ == "mappings":
1340 eq_(u1, {"user_id": 1, "user_name": "name%d" % 1})
1341 elif filter_ == "scalars":
1342 eq_(u1, 1)
1343 else:
1344 eq_(u1, (1, "name%d" % 1))
1345
1346 @async_test
1347 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