Skip to content

Commit 46a34be

Browse files
committed
fixed tests
1 parent dfc8d2a commit 46a34be

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

duckdb/filesystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class ModifiedMemoryFileSystem(MemoryFileSystem):
2121
# defer to the original implementation that doesn't hardcode the protocol
2222
_strip_protocol: typing.Callable[[str], str] = classmethod(AbstractFileSystem._strip_protocol.__func__) # type: ignore[assignment]
2323

24-
def add_file(self, obj: io.IOBase | BytesIOWrapper, path: str) -> None:
24+
def add_file(self, obj: io.IOBase | BytesIOWrapper | object, path: str) -> None:
2525
"""Add a file to the filesystem."""
26-
if not isinstance(obj, io.IOBase):
26+
if not (hasattr(obj, "read") and hasattr(obj, "seek")):
2727
msg = "Can not read from a non file-like object"
2828
raise TypeError(msg)
2929
if isinstance(obj, io.TextIOBase):

duckdb/polars_io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def _pl_tree_to_sql(tree: _ExpressionTree) -> str:
224224
# Binary type
225225
if dtype == "Binary":
226226
bin_value = value["Binary"]
227-
assert isinstance(bin_value, bytes), f"A {dtype} should be bytes but got {type(bin_value)}"
227+
assert isinstance(bin_value, list), f"A {dtype} should be a list but got {type(bin_value)}"
228228
binary_data = bytes(bin_value)
229229
escaped = "".join(f"\\x{b:02x}" for b in binary_data)
230230
return f"'{escaped}'::BLOB"

tests/fast/adbc/test_connection_get_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_connection_get_info_all(self):
2323
expected_result = pa.array(
2424
[
2525
"duckdb",
26-
"v" + duckdb.duckdb_version, # don't hardcode this, as it will change every version
26+
"v" + duckdb.__duckdb_version__, # don't hardcode this, as it will change every version
2727
"ADBC DuckDB Driver",
2828
"(unknown)",
2929
"(unknown)",

tests/fast/api/test_explain.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ def test_explain_standard(self, duckdb_cursor):
1515
res = duckdb_cursor.sql("select 42").explain("STANDARD")
1616
assert isinstance(res, str)
1717

18-
res = duckdb_cursor.sql("select 42").explain(duckdb.STANDARD)
19-
assert isinstance(res, str)
20-
2118
res = duckdb_cursor.sql("select 42").explain(duckdb.ExplainType.STANDARD)
2219
assert isinstance(res, str)
2320

tests/fast/api/test_read_csv.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def test_header_true(self, duckdb_cursor):
9292
print(res)
9393
assert res == (1, "Action", datetime.datetime(2006, 2, 15, 4, 46, 27))
9494

95-
@pytest.mark.skip(reason="Issue #6011 needs to be fixed first, header=False doesn't work correctly")
9695
def test_header_false(self, duckdb_cursor):
9796
duckdb_cursor.read_csv(TestFile("category.csv"), header=False)
9897

@@ -383,13 +382,13 @@ def read(self, amount=-1):
383382
def test_filelike_non_readable(self, duckdb_cursor):
384383
_ = pytest.importorskip("fsspec")
385384
obj = 5
386-
with pytest.raises(ValueError, match="Can not read from a non file-like object"):
385+
with pytest.raises(TypeError, match="Can not read from a non file-like object"):
387386
duckdb_cursor.read_csv(obj).fetchall()
388387

389388
def test_filelike_none(self, duckdb_cursor):
390389
_ = pytest.importorskip("fsspec")
391390
obj = None
392-
with pytest.raises(ValueError, match="Can not read from a non file-like object"):
391+
with pytest.raises(TypeError, match="Can not read from a non file-like object"):
393392
duckdb_cursor.read_csv(obj).fetchall()
394393

395394
@pytest.mark.skip(reason="depends on garbage collector behaviour, and sporadically breaks in CI")

0 commit comments

Comments
 (0)