MCPcopy
hub / github.com/psycopg/psycopg / test_as_bytes

Method test_as_bytes

tests/test_sql.py:504–510  ·  view source on GitHub ↗
(self, conn, encoding)

Source from the content-addressed store, hash-verified

502
503 @pytest.mark.parametrize("encoding", ["utf8", crdb_encoding("latin9")])
504 def test_as_bytes(self, conn, encoding):
505 if encoding:
506 conn.execute(f"set client_encoding to {encoding}")
507
508 got = sql.SQL(eur).as_bytes(conn)
509 assert isinstance(got, bytes)
510 assert got == eur.encode(encoding)
511
512 def test_no_conn(self):
513 assert sql.SQL(eur).as_string() == eur

Callers

nothing calls this directly

Calls 2

executeMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected