Skip to content

Commit

Permalink
Add float_vector psycopg3 test
Browse files Browse the repository at this point in the history
  • Loading branch information
matriv committed Sep 22, 2023
1 parent 20b1220 commit 5fd9cec
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/client_tests/python/psycopg3/test_psycopg3.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ async def bitstring_can_be_inserted_and_selected_using_binary_encoding(test, con
"""


async def float_vector_can_be_inserted_and_selected(test, conn):
fv = [1.1, 2.2, 3.3, 4.4]
await conn.execute('drop table if exists tbl_fv')
await conn.execute('create table tbl_fv (id int, fv float_vector(4))')
await conn.execute('insert into tbl_fv (id, fv) values (1, [1.1, 2.2, 3.3, 4.4])')
await conn.execute('insert into tbl_fv (id, fv) values (2, null)')
await conn.execute('refresh table tbl_fv')
cur = await conn.execute('select * from tbl_fv order by id')
result = await cur.fetchall()
test.assertEqual(result[0][1], fv)
test.assertEqual(result[1][1], None)


async def fetch_summits_client_cursor(test, uri):
"""
Use the `cursor.execute` method to acquire results, using a client-side cursor.
Expand Down Expand Up @@ -170,6 +183,7 @@ async def exec_queries_pooled(test, uri):
await basic_queries(test, conn)
await record_type_can_be_read_using_binary_streaming(test, conn)
await bitstring_can_be_inserted_and_selected_using_binary_encoding(test, conn)
await float_vector_can_be_inserted_and_selected(test, conn)
await pool.close()


Expand Down

0 comments on commit 5fd9cec

Please sign in to comment.