mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Fix mypy & tests
This commit is contained in:
parent
3debd18d82
commit
8227190a8d
4 changed files with 9 additions and 5 deletions
|
|
@ -35,4 +35,8 @@ async def edit_dad_joke(session: AsyncSession, joke_id: int, new_joke: str) -> D
|
|||
async def get_random_dad_joke(session: AsyncSession) -> DadJoke:
|
||||
"""Return a random database entry"""
|
||||
statement = select(DadJoke).order_by(func.random())
|
||||
return (await session.execute(statement)).first()
|
||||
row = (await session.execute(statement)).first()
|
||||
if row is None:
|
||||
raise NoResultFoundException
|
||||
|
||||
return row[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue