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

Method test_executemany_prepare

tests/test_execute.py:354–375  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

352 self.assertEqual(result, [])
353
354 async def test_executemany_prepare(self):
355 stmt = await self.con.prepare('''
356 INSERT INTO exmany VALUES($1, $2)
357 ''')
358 result = await stmt.executemany([
359 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
360 ])
361 self.assertIsNone(result)
362 result = await self.con.fetch('''
363 SELECT * FROM exmany
364 ''')
365 self.assertEqual(result, [
366 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
367 ])
368 # Empty set
369 await stmt.executemany(())
370 result = await self.con.fetch('''
371 SELECT * FROM exmany
372 ''')
373 self.assertEqual(result, [
374 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
375 ])

Callers

nothing calls this directly

Calls 3

prepareMethod · 0.45
executemanyMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected