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

Method test_executemany_prepare

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

Source from the content-addressed store, hash-verified

326 self.assertEqual(result, [])
327
328 async def test_executemany_prepare(self):
329 stmt = await self.con.prepare('''
330 INSERT INTO exmany VALUES($1, $2)
331 ''')
332 result = await stmt.executemany([
333 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
334 ])
335 self.assertIsNone(result)
336 result = await self.con.fetch('''
337 SELECT * FROM exmany
338 ''')
339 self.assertEqual(result, [
340 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
341 ])
342 # Empty set
343 await stmt.executemany(())
344 result = await self.con.fetch('''
345 SELECT * FROM exmany
346 ''')
347 self.assertEqual(result, [
348 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
349 ])

Callers

nothing calls this directly

Calls 3

prepareMethod · 0.80
executemanyMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected