MCPcopy
hub / github.com/psycopg/psycopg / test_random

Function test_random

tests/test_adapt.py:497–512  ·  view source on GitHub ↗
(conn, faker, fmt, fmt_out)

Source from the content-addressed store, hash-verified

495@pytest.mark.parametrize("fmt", PyFormat)
496@pytest.mark.parametrize("fmt_out", [pq.Format.TEXT, pq.Format.BINARY])
497def test_random(conn, faker, fmt, fmt_out):
498 faker.format = fmt
499 faker.choose_schema(ncols=20)
500 faker.make_records(50)
501
502 with conn.cursor(binary=fmt_out) as cur:
503 cur.execute(faker.drop_stmt)
504 cur.execute(faker.create_stmt)
505 with faker.find_insert_problem(conn):
506 cur.executemany(faker.insert_stmt, faker.records)
507
508 cur.execute(faker.select_stmt)
509 recs = cur.fetchall()
510
511 for got, want in zip(recs, faker.records):
512 faker.assert_record(got, want)
513
514
515class MyStr(str):

Callers

nothing calls this directly

Calls 8

choose_schemaMethod · 0.80
make_recordsMethod · 0.80
find_insert_problemMethod · 0.80
assert_recordMethod · 0.80
cursorMethod · 0.45
executeMethod · 0.45
executemanyMethod · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected