Skip to content

Commit da7817a

Browse files
fix
1 parent ef5c2ed commit da7817a

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

pandas/tests/io/test_sql.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4374,19 +4374,25 @@ def test_bytes_column(con, request):
43744374

43754375
dtype = "O"
43764376
val = b"\x01#Eg\x89\xab\xcd\xef\x01#Eg\x89\xab\xcd\xef"
4377-
if dtype_backend == "pyarrow" and "postgres" in con:
4378-
# postgres column is a bit type
4379-
# but converts to a string when returned
4380-
dtype = pd.ArrowDtype(pa.string())
4377+
4378+
if "postgres" in con:
43814379
val = (
4382-
"0000000100100011010001010110011110001001101010"
4380+
b"\x00\x00\x00\x80\x01#Eg\x89\xab\xcd\xef\x01#Eg\x89\xab\xcd\xef"
4381+
if "adbc" in con
4382+
else "0000000100100011010001010110011110001001101010"
43834383
"11110011011110111100000001001000110100010101100"
43844384
"11110001001101010111100110111101111"
43854385
)
4386-
elif dtype_backend == "pyarrow":
4387-
# sqlite3 + mysql both return a binary type
4388-
# for the binary literal
4389-
dtype = pd.ArrowDtype(pa.binary())
4386+
4387+
if "psycopg2" in con and dtype_backend == "numpy_nullable":
4388+
dtype = pd.StringDtype()
4389+
4390+
if dtype_backend == "pyarrow":
4391+
dtype = (
4392+
pd.ArrowDtype(pa.string())
4393+
if "postgres" in con and "adbc" not in con
4394+
else pd.ArrowDtype(pa.binary())
4395+
)
43904396

43914397
expected = DataFrame([{"a": val}], dtype=dtype)
43924398
tm.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)