MCPcopy
hub / github.com/MagicStack/asyncpg / test_prepare_fetchmany

Method test_prepare_fetchmany

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

Source from the content-addressed store, hash-verified

613 await self.con.prepare('select 1', name='foobar')
614
615 async def test_prepare_fetchmany(self):
616 tr = self.con.transaction()
617 await tr.start()
618 try:
619 await self.con.execute('CREATE TABLE fetchmany (a int, b text)')
620
621 stmt = await self.con.prepare(
622 'INSERT INTO fetchmany (a, b) VALUES ($1, $2) RETURNING a, b'
623 )
624 result = await stmt.fetchmany([(1, 'a'), (2, 'b'), (3, 'c')])
625 self.assertEqual(result, [(1, 'a'), (2, 'b'), (3, 'c')])
626 finally:
627 await tr.rollback()

Callers

nothing calls this directly

Calls 6

transactionMethod · 0.80
prepareMethod · 0.80
rollbackMethod · 0.80
startMethod · 0.45
executeMethod · 0.45
fetchmanyMethod · 0.45

Tested by

no test coverage detected