Skip to content

Commit 206acee

Browse files
test: Fix integration tests before release (#314)
1 parent 24b71b4 commit 206acee

File tree

3 files changed

+23
-56
lines changed

3 files changed

+23
-56
lines changed

tests/integration/dbapi/async/test_queries_async.py

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44

55
from pytest import mark, raises
66

7-
from firebolt.async_db import (
8-
Binary,
9-
Connection,
10-
Cursor,
11-
DataError,
12-
OperationalError,
13-
)
7+
from firebolt.async_db import Binary, Connection, Cursor, OperationalError
148
from firebolt.async_db.cursor import QueryStatus
159
from firebolt.common._types import ColType, Column
1610
from tests.integration.dbapi.utils import assert_deep_eq
@@ -186,17 +180,12 @@ async def test_insert(connection: Connection) -> None:
186180
"""Insert and delete queries are handled properly."""
187181

188182
async def test_empty_query(c: Cursor, query: str) -> None:
189-
assert await c.execute(query) == -1, "Invalid row count returned"
190-
assert c.rowcount == -1, "Invalid rowcount value"
183+
assert await c.execute(query) == 0, "Invalid row count returned"
184+
assert c.rowcount == 0, "Invalid rowcount value"
191185
assert c.description is None, "Invalid description"
192-
with raises(DataError):
193-
await c.fetchone()
194-
195-
with raises(DataError):
196-
await c.fetchmany()
197-
198-
with raises(DataError):
199-
await c.fetchall()
186+
assert await c.fetchone() is None
187+
assert len(await c.fetchmany()) == 0
188+
assert len(await c.fetchall()) == 0
200189

201190
with connection.cursor() as c:
202191
await c.execute("DROP TABLE IF EXISTS test_insert_async_tb")
@@ -239,17 +228,12 @@ async def test_parameterized_query(connection: Connection) -> None:
239228
"""Query parameters are handled properly."""
240229

241230
async def test_empty_query(c: Cursor, query: str, params: tuple) -> None:
242-
assert await c.execute(query, params) == -1, "Invalid row count returned"
243-
assert c.rowcount == -1, "Invalid rowcount value"
231+
assert await c.execute(query, params) == 0, "Invalid row count returned"
232+
assert c.rowcount == 0, "Invalid rowcount value"
244233
assert c.description is None, "Invalid description"
245-
with raises(DataError):
246-
await c.fetchone()
247-
248-
with raises(DataError):
249-
await c.fetchmany()
250-
251-
with raises(DataError):
252-
await c.fetchall()
234+
assert await c.fetchone() is None
235+
assert len(await c.fetchmany()) == 0
236+
assert len(await c.fetchall()) == 0
253237

254238
with connection.cursor() as c:
255239
await c.execute("DROP TABLE IF EXISTS test_tb_async_parameterized")

tests/integration/dbapi/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def all_types_query() -> str:
6363
"30000000000 as uint64, "
6464
"-30000000000 as int64, "
6565
"cast(1.23 AS FLOAT) as float32, "
66-
"1.2345678901234 as float64, "
66+
"1.23456789012 as float64, "
6767
"'text' as \"string\", "
6868
"CAST('2021-03-28' AS DATE) as \"date\", "
6969
"pgdate '0001-01-01' as \"pgdate\", "

tests/integration/dbapi/sync/test_queries.py

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@
88
from firebolt.async_db.cursor import QueryStatus
99
from firebolt.client.auth import Auth
1010
from firebolt.common._types import ColType, Column
11-
from firebolt.db import (
12-
Binary,
13-
Connection,
14-
Cursor,
15-
DataError,
16-
OperationalError,
17-
connect,
18-
)
11+
from firebolt.db import Binary, Connection, Cursor, OperationalError, connect
1912
from tests.integration.dbapi.utils import assert_deep_eq
2013

2114
VALS_TO_INSERT = ",".join([f"({i},'{val}')" for (i, val) in enumerate(range(1, 360))])
@@ -192,17 +185,12 @@ def test_insert(connection: Connection) -> None:
192185
"""Insert and delete queries are handled properly."""
193186

194187
def test_empty_query(c: Cursor, query: str) -> None:
195-
assert c.execute(query) == -1, "Invalid row count returned"
196-
assert c.rowcount == -1, "Invalid rowcount value"
188+
assert c.execute(query) == 0, "Invalid row count returned"
189+
assert c.rowcount == 0, "Invalid rowcount value"
197190
assert c.description is None, "Invalid description"
198-
with raises(DataError):
199-
c.fetchone()
200-
201-
with raises(DataError):
202-
c.fetchmany()
203-
204-
with raises(DataError):
205-
c.fetchall()
191+
assert c.fetchone() is None
192+
assert len(c.fetchmany()) == 0
193+
assert len(c.fetchall()) == 0
206194

207195
with connection.cursor() as c:
208196
c.execute("DROP TABLE IF EXISTS test_insert_tb")
@@ -242,17 +230,12 @@ def test_parameterized_query(connection: Connection) -> None:
242230
"""Query parameters are handled properly."""
243231

244232
def test_empty_query(c: Cursor, query: str, params: tuple) -> None:
245-
assert c.execute(query, params) == -1, "Invalid row count returned"
246-
assert c.rowcount == -1, "Invalid rowcount value"
233+
assert c.execute(query, params) == 0, "Invalid row count returned"
234+
assert c.rowcount == 0, "Invalid rowcount value"
247235
assert c.description is None, "Invalid description"
248-
with raises(DataError):
249-
c.fetchone()
250-
251-
with raises(DataError):
252-
c.fetchmany()
253-
254-
with raises(DataError):
255-
c.fetchall()
236+
assert c.fetchone() is None
237+
assert len(c.fetchmany()) == 0
238+
assert len(c.fetchall()) == 0
256239

257240
with connection.cursor() as c:
258241
c.execute("DROP TABLE IF EXISTS test_tb_parameterized")

0 commit comments

Comments
 (0)