forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
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
3 changed files
with
71 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -335,3 +335,6 @@ tools/pythonpkg/tests/userdata1.parquet | |
# node tests | ||
__nvm | ||
|
||
*.vcxproj* | ||
*.cmake | ||
*.sln |
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 |
---|---|---|
@@ -1,9 +1,28 @@ | ||
# cursor description | ||
from datetime import datetime, date | ||
from pytest import mark | ||
|
||
|
||
class TestCursorDescription(object): | ||
def test_description(self, duckdb_cursor): | ||
description = duckdb_cursor.execute("SELECT * FROM integers").description | ||
assert description == [('i', None, None, None, None, None, None)] | ||
@mark.parametrize( | ||
"query,column_name,string_type,real_type", | ||
[ | ||
["SELECT * FROM integers", "i", "NUMBER", int], | ||
["SELECT * FROM timestamps", "t", "DATETIME", datetime], | ||
["SELECT DATE '1992-09-20';", "CAST(1992-09-20 AS DATE)", "Date", date], | ||
["SELECT '\\xAA'::BLOB;", "\\xAA", "BINARY", bytes], | ||
["SELECT {'x': 1, 'y': 2, 'z': 3}", "struct_pack(1, 2, 3)", "dict", dict], | ||
["SELECT [1, 2, 3]", "list_value(1, 2, 3)", "list", list], | ||
], | ||
) | ||
def test_description( | ||
self, query, column_name, string_type, real_type, duckdb_cursor | ||
): | ||
duckdb_cursor.execute(query) | ||
assert duckdb_cursor.description == [ | ||
(column_name, string_type, None, None, None, None, None) | ||
] | ||
assert isinstance(duckdb_cursor.fetchone()[0], real_type) | ||
|
||
def test_none_description(self, duckdb_empty_cursor): | ||
assert duckdb_empty_cursor.description is None |