MCPcopy
hub / github.com/psycopg/psycopg / test_iter

Function test_iter

tests/test_cursor_server_async.py:427–437  ·  view source on GitHub ↗
(aconn)

Source from the content-addressed store, hash-verified

425
426
427async def test_iter(aconn):
428 async with aconn.cursor("foo") as cur:
429 await cur.execute(ph(cur, "select generate_series(1, %s) as bar"), (3,))
430 recs = await alist(cur)
431 assert recs == [(1,), (2,), (3,)]
432
433 async with aconn.cursor("foo") as cur:
434 await cur.execute(ph(cur, "select generate_series(1, %s) as bar"), (3,))
435 assert await cur.fetchone() == (1,)
436 recs = await alist(cur)
437 assert recs == [(2,), (3,)]
438
439
440async def test_iter_rownumber(aconn):

Callers

nothing calls this directly

Calls 5

phFunction · 0.85
alistFunction · 0.85
cursorMethod · 0.45
executeMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected