|
1 | 1 | import duckdb |
| 2 | +import duckdb.typing |
2 | 3 | import pytest |
3 | 4 | from conftest import NumpyPandas, ArrowPandas |
4 | 5 |
|
@@ -113,9 +114,28 @@ def test_readonly_properties(self): |
113 | 114 | duckdb.execute("select 42") |
114 | 115 | description = duckdb.description() |
115 | 116 | rowcount = duckdb.rowcount() |
116 | | - assert description == [('42', 'NUMBER', None, None, None, None, None)] |
| 117 | + assert description == [('42', 'INTEGER', None, None, None, None, None)] |
117 | 118 | assert rowcount == -1 |
118 | 119 |
|
| 120 | + def test_description(self): |
| 121 | + duckdb.execute("select 42 a, 'test' b, true c") |
| 122 | + types = [x[1] for x in duckdb.description()] |
| 123 | + |
| 124 | + STRING = duckdb.STRING |
| 125 | + NUMBER = duckdb.NUMBER |
| 126 | + DATETIME = duckdb.DATETIME |
| 127 | + |
| 128 | + assert(types[1] == STRING) |
| 129 | + assert(STRING == types[1]) |
| 130 | + assert(types[0] != STRING) |
| 131 | + assert((types[1] != STRING) == False) |
| 132 | + assert((STRING != types[1]) == False) |
| 133 | + |
| 134 | + assert(types[1] in [STRING]) |
| 135 | + assert(types[1] in [STRING, NUMBER]) |
| 136 | + assert(types[1] not in [NUMBER, DATETIME]) |
| 137 | + |
| 138 | + |
119 | 139 | def test_execute(self): |
120 | 140 | assert [([4, 2],)] == duckdb.execute("select [4,2]").fetchall() |
121 | 141 |
|
|
0 commit comments