MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_get_one

Method test_get_one

test/ext/asyncio/test_session.py:339–354  ·  view source on GitHub ↗
(self, async_session)

Source from the content-addressed store, hash-verified

337
338 @async_test
339 async def test_get_one(self, async_session):
340 User = self.classes.User
341
342 u1 = await async_session.get_one(User, 7)
343 u2 = await async_session.get_one(User, 10)
344 u3 = await async_session.get_one(User, 7)
345
346 is_(u1, u3)
347 eq_(u1.name, "jack")
348 eq_(u2.name, "chuck")
349
350 with testing.expect_raises_message(
351 exc.NoResultFound,
352 "No row was found when one was required",
353 ):
354 await async_session.get_one(User, 12)
355
356 @async_test
357 async def test_force_a_lazyload(self, async_session):

Callers

nothing calls this directly

Calls 3

is_Function · 0.90
eq_Function · 0.90
get_oneMethod · 0.45

Tested by

no test coverage detected