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

Method test_executemany_basic

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

Source from the content-addressed store, hash-verified

110 super().tearDown()
111
112 async def test_executemany_basic(self):
113 result = await self.con.executemany('''
114 INSERT INTO exmany VALUES($1, $2)
115 ''', [
116 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
117 ])
118
119 self.assertIsNone(result)
120
121 result = await self.con.fetch('''
122 SELECT * FROM exmany
123 ''')
124
125 self.assertEqual(result, [
126 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
127 ])
128
129 # Empty set
130 await self.con.executemany('''
131 INSERT INTO exmany VALUES($1, $2)
132 ''', ())
133
134 result = await self.con.fetch('''
135 SELECT * FROM exmany
136 ''')
137
138 self.assertEqual(result, [
139 ('a', 1), ('b', 2), ('c', 3), ('d', 4)
140 ])
141
142 async def test_executemany_returning(self):
143 result = await self.con.fetchmany('''

Callers

nothing calls this directly

Calls 2

executemanyMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected