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

Method test_executemany_bad_input

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

Source from the content-addressed store, hash-verified

205 ])
206
207 async def test_executemany_bad_input(self):
208 with self.assertRaisesRegex(
209 exceptions.DataError,
210 r"invalid input in executemany\(\) argument sequence element #1: "
211 r"expected a sequence",
212 ):
213 await self.con.executemany('''
214 INSERT INTO exmany (b) VALUES($1)
215 ''', [(0,), {1: 0}])
216
217 with self.assertRaisesRegex(
218 exceptions.DataError,
219 r"invalid input for query argument \$1 in element #1 of "
220 r"executemany\(\) sequence: 'bad'",
221 ):
222 await self.con.executemany('''
223 INSERT INTO exmany (b) VALUES($1)
224 ''', [(0,), ("bad",)])
225
226 async def test_executemany_error_in_input_gen(self):
227 bad_data = ([1 / 0] for v in range(10))

Callers

nothing calls this directly

Calls 1

executemanyMethod · 0.45

Tested by

no test coverage detected