|
8 | 8 | from firebolt.async_db.cursor import QueryStatus |
9 | 9 | from firebolt.client.auth import Auth |
10 | 10 | 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 |
19 | 12 | from tests.integration.dbapi.utils import assert_deep_eq |
20 | 13 |
|
21 | 14 | 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: |
192 | 185 | """Insert and delete queries are handled properly.""" |
193 | 186 |
|
194 | 187 | 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" |
197 | 190 | 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 |
206 | 194 |
|
207 | 195 | with connection.cursor() as c: |
208 | 196 | c.execute("DROP TABLE IF EXISTS test_insert_tb") |
@@ -242,17 +230,12 @@ def test_parameterized_query(connection: Connection) -> None: |
242 | 230 | """Query parameters are handled properly.""" |
243 | 231 |
|
244 | 232 | 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" |
247 | 235 | 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 |
256 | 239 |
|
257 | 240 | with connection.cursor() as c: |
258 | 241 | c.execute("DROP TABLE IF EXISTS test_tb_parameterized") |
|
0 commit comments