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

Method test_prepare_statement_invalid

tests/test_prepare.py:415–431  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

413 self.assertEqual(repr(result), '<Record>')
414
415 async def test_prepare_statement_invalid(self):
416 await self.con.execute('CREATE TABLE tab1(a int, b int)')
417
418 try:
419 await self.con.execute('INSERT INTO tab1 VALUES (1, 2)')
420
421 stmt = await self.con.prepare('SELECT * FROM tab1')
422
423 await self.con.execute(
424 'ALTER TABLE tab1 ALTER COLUMN b SET DATA TYPE text')
425
426 with self.assertRaisesRegex(asyncpg.InvalidCachedStatementError,
427 'cached statement plan is invalid'):
428 await stmt.fetchrow()
429
430 finally:
431 await self.con.execute('DROP TABLE tab1')
432
433 @tb.with_connection_options(statement_cache_size=0)
434 async def test_prepare_23_no_stmt_cache_seq(self):

Callers

nothing calls this directly

Calls 3

prepareMethod · 0.80
executeMethod · 0.45
fetchrowMethod · 0.45

Tested by

no test coverage detected