MCPcopy
hub / github.com/psycopg/psycopg / test_copy_bad_result

Function test_copy_bad_result

tests/test_copy_async.py:250–273  ·  view source on GitHub ↗
(aconn)

Source from the content-addressed store, hash-verified

248
249
250async def test_copy_bad_result(aconn):
251 await aconn.set_autocommit(True)
252
253 cur = aconn.cursor()
254
255 with pytest.raises(e.SyntaxError):
256 async with cur.copy("wat"):
257 pass
258
259 with pytest.raises(e.ProgrammingError):
260 async with cur.copy("select 1"):
261 pass
262
263 with pytest.raises(e.ProgrammingError):
264 async with cur.copy("reset timezone"):
265 pass
266
267 with pytest.raises(e.ProgrammingError):
268 async with cur.copy("copy (select 1) to stdout; select 1") as copy:
269 await alist(copy)
270
271 with pytest.raises(e.ProgrammingError):
272 async with cur.copy("select 1; copy (select 1) to stdout"):
273 pass
274
275
276async def test_copy_in_str(aconn):

Callers

nothing calls this directly

Calls 4

alistFunction · 0.85
set_autocommitMethod · 0.45
cursorMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected