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

Method test_executemany_bad_input

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

Source from the content-addressed store, hash-verified

179 ])
180
181 async def test_executemany_bad_input(self):
182 with self.assertRaisesRegex(
183 exceptions.DataError,
184 r"invalid input in executemany\(\) argument sequence element #1: "
185 r"expected a sequence",
186 ):
187 await self.con.executemany('''
188 INSERT INTO exmany (b) VALUES($1)
189 ''', [(0,), {1: 0}])
190
191 with self.assertRaisesRegex(
192 exceptions.DataError,
193 r"invalid input for query argument \$1 in element #1 of "
194 r"executemany\(\) sequence: 'bad'",
195 ):
196 await self.con.executemany('''
197 INSERT INTO exmany (b) VALUES($1)
198 ''', [(0,), ("bad",)])
199
200 async def test_executemany_error_in_input_gen(self):
201 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