Skip to content

Commit

Permalink
Unbreak test broken in #1185
Browse files Browse the repository at this point in the history
  • Loading branch information
elprans committed Oct 17, 2024
1 parent aa2d0e6 commit 8f2be4c
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ async def test_exceptions_str(self):
CREATE FUNCTION foo() RETURNS bool AS $$ $$ LANGUAGE SQL;
''')
except asyncpg.InvalidFunctionDefinitionError as e:
self.assertEqual(
e.detail,
"Function's final statement must be SELECT or "
"INSERT/UPDATE/DELETE/MERGE RETURNING.")
self.assertIn(
'DETAIL: Function', str(e)
)
if self.server_version < (17, 0):
detail = (
"Function's final statement must be SELECT or "
"INSERT/UPDATE/DELETE RETURNING."
)
else:
detail = (
"Function's final statement must be SELECT or "
"INSERT/UPDATE/DELETE/MERGE RETURNING."
)

self.assertEqual(e.detail, detail)
self.assertIn('DETAIL: Function', str(e))
else:
self.fail('InvalidFunctionDefinitionError not raised')

0 comments on commit 8f2be4c

Please sign in to comment.