Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a8f69e5

Browse files
committedJan 21, 2025
addressing comments
1 parent 2afeed5 commit a8f69e5

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed
 

‎pandas/tests/io/test_sql.py

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4361,38 +4361,34 @@ def test_xsqlite_if_exists(sqlite_buildin):
43614361

43624362

43634363
@pytest.mark.parametrize("con", all_connectable)
4364-
@pytest.mark.parametrize("dtype_backend", ["pyarrow", "numpy_nullable", lib.no_default])
43654364
def test_bytes_column(con, dtype_backend, request):
43664365
# GitHub Issue #59242
43674366
conn = request.getfixturevalue(con)
43684367
pa = pytest.importorskip("pyarrow")
43694368

4370-
dtype = "O"
43714369
val = b"\x01#Eg\x89\xab\xcd\xef\x01#Eg\x89\xab\xcd\xef"
4372-
43734370
if "postgres" in con:
4374-
val = (
4375-
b"\x00\x00\x00\x80\x01#Eg\x89\xab\xcd\xef\x01#Eg\x89\xab\xcd\xef"
4376-
if "adbc" in con
4377-
else "0000000100100011010001010110011110001001101010"
4378-
"11110011011110111100000001001000110100010101100"
4379-
"11110001001101010111100110111101111"
4380-
)
4381-
if dtype_backend == "pyarrow":
4382-
dtype = (
4383-
pd.ArrowDtype(pa.string())
4384-
if "adbc" not in con
4385-
else pd.ArrowDtype(pa.opaque(pa.binary(), "bit", "PostgreSQL"))
4371+
if "adbc" in con:
4372+
val = b"\x00\x00\x00\x80\x01#Eg\x89\xab\xcd\xef\x01#Eg\x89\xab\xcd\xef"
4373+
else:
4374+
val = (
4375+
"0000000100100011010001010110011110001001101010"
4376+
"11110011011110111100000001001000110100010101100"
4377+
"11110001001101010111100110111101111"
43864378
)
43874379

4388-
if "psycopg2" in con:
4380+
if dtype_backend == "pyarrow":
4381+
dtype = pd.ArrowDtype(pa.binary())
4382+
if "postgres" in con:
4383+
if "adbc" in con:
4384+
dtype = pd.ArrowDtype(pa.opaque(pa.binary(), "bit", "PostgreSQL"))
4385+
else:
4386+
dtype = pd.ArrowDtype(pa.string())
4387+
else:
4388+
dtype = "O"
4389+
if "postgres" in con and "psycopg2" in con:
43894390
if dtype_backend == "numpy_nullable":
43904391
dtype = pd.StringDtype()
4391-
elif dtype_backend == lib.no_default and pd.options.future.infer_string:
4392-
dtype = pd.StringDtype(storage="pyarrow", na_value=np.nan)
4393-
4394-
if "postgres" not in con and dtype_backend == "pyarrow":
4395-
dtype = pd.ArrowDtype(pa.binary())
43964392

43974393
expected = DataFrame([{"a": val}], dtype=dtype)
43984394
df = pd.read_sql(

0 commit comments

Comments
 (0)
Please sign in to comment.