|
18 | 18 | pa_version_under15p0,
|
19 | 19 | pa_version_under17p0,
|
20 | 20 | pa_version_under19p0,
|
| 21 | + pa_version_under20p0, |
21 | 22 | )
|
22 | 23 |
|
23 | 24 | import pandas as pd
|
@@ -1075,27 +1076,34 @@ def test_read_dtype_backend_pyarrow_config_index(self, pa):
|
1075 | 1076 | expected=expected,
|
1076 | 1077 | )
|
1077 | 1078 |
|
1078 |
| - @pytest.mark.xfail( |
1079 |
| - pa_version_under17p0, reason="pa.pandas_compat passes 'datetime64' to .astype" |
| 1079 | + @pytest.mark.parametrize( |
| 1080 | + "columns", |
| 1081 | + [ |
| 1082 | + [0, 1], |
| 1083 | + pytest.param( |
| 1084 | + [b"foo", b"bar"], |
| 1085 | + marks=pytest.mark.xfail( |
| 1086 | + pa_version_under20p0, |
| 1087 | + raises=NotImplementedError, |
| 1088 | + reason="https://github.com/apache/arrow/pull/44171", |
| 1089 | + ), |
| 1090 | + ), |
| 1091 | + pytest.param( |
| 1092 | + [ |
| 1093 | + datetime.datetime(2011, 1, 1, 0, 0), |
| 1094 | + datetime.datetime(2011, 1, 1, 1, 1), |
| 1095 | + ], |
| 1096 | + marks=pytest.mark.xfail( |
| 1097 | + pa_version_under17p0, |
| 1098 | + reason="pa.pandas_compat passes 'datetime64' to .astype", |
| 1099 | + ), |
| 1100 | + ), |
| 1101 | + ], |
1080 | 1102 | )
|
1081 |
| - def test_columns_dtypes_not_invalid(self, pa): |
| 1103 | + def test_columns_dtypes_not_invalid(self, pa, columns): |
1082 | 1104 | df = pd.DataFrame({"string": list("abc"), "int": list(range(1, 4))})
|
1083 | 1105 |
|
1084 |
| - # numeric |
1085 |
| - df.columns = [0, 1] |
1086 |
| - check_round_trip(df, pa) |
1087 |
| - |
1088 |
| - # bytes |
1089 |
| - df.columns = [b"foo", b"bar"] |
1090 |
| - with pytest.raises(NotImplementedError, match="|S3"): |
1091 |
| - # Bytes fails on read_parquet |
1092 |
| - check_round_trip(df, pa) |
1093 |
| - |
1094 |
| - # python object |
1095 |
| - df.columns = [ |
1096 |
| - datetime.datetime(2011, 1, 1, 0, 0), |
1097 |
| - datetime.datetime(2011, 1, 1, 1, 1), |
1098 |
| - ] |
| 1106 | + df.columns = columns |
1099 | 1107 | check_round_trip(df, pa)
|
1100 | 1108 |
|
1101 | 1109 | def test_empty_columns(self, pa):
|
|
0 commit comments