MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_exceptions_str

Method test_exceptions_str

tests/test_exceptions.py:36–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

34 self.fail('UndefinedTableError not raised')
35
36 async def test_exceptions_str(self):
37 try:
38 await self.con.execute('''
39 CREATE FUNCTION foo() RETURNS bool AS $$ $$ LANGUAGE SQL;
40 ''')
41 except asyncpg.InvalidFunctionDefinitionError as e:
42 if self.server_version < (17, 0):
43 detail = (
44 "Function's final statement must be SELECT or "
45 "INSERT/UPDATE/DELETE RETURNING."
46 )
47 else:
48 detail = (
49 "Function's final statement must be SELECT or "
50 "INSERT/UPDATE/DELETE/MERGE RETURNING."
51 )
52
53 self.assertEqual(e.detail, detail)
54 self.assertIn('DETAIL: Function', str(e))
55 else:
56 self.fail('InvalidFunctionDefinitionError not raised')

Callers

nothing calls this directly

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected