-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import psycopg | ||
|
||
def test_psycopg_extended_mode(): | ||
conn = psycopg.connect(host='localhost', port='4566', dbname='dev', user='root') | ||
with conn.cursor() as cur: | ||
cur.execute("select Array[1::bigint, 2::bigint, 3::bigint]", binary=True) | ||
assert cur.fetchone() == ([1, 2, 3],) | ||
|
||
cur.execute("select Array['foo', null, 'bar']", binary=True) | ||
assert cur.fetchone() == (['foo', None, 'bar'],) | ||
|
||
cur.execute("select ROW('123 Main St', 'New York', '10001')", binary=True) | ||
assert cur.fetchone() == (('123 Main St', 'New York', '10001'),) | ||
|
||
cur.execute("select array[ROW('123 Main St', 'New York', '10001'), ROW('234 Main St', null, '10001')]", binary=True) | ||
assert cur.fetchone() == ([('123 Main St', 'New York', '10001'), ('234 Main St', None, '10001')],) | ||
|
||
if __name__ == '__main__': | ||
test_psycopg_extended_mode() |