|
6 | 6 |
|
7 | 7 | from pandas._config import using_string_dtype |
8 | 8 |
|
9 | | -from pandas.compat import HAS_PYARROW |
10 | | - |
11 | 9 | from pandas.core.dtypes.common import is_scalar |
12 | 10 |
|
13 | 11 | import pandas as pd |
@@ -940,9 +938,6 @@ def test_where_nullable_invalid_na(frame_or_series, any_numeric_ea_dtype): |
940 | 938 | obj.mask(mask, null) |
941 | 939 |
|
942 | 940 |
|
943 | | -@pytest.mark.xfail( |
944 | | - using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)" |
945 | | -) |
946 | 941 | @given(data=OPTIONAL_ONE_OF_ALL) |
947 | 942 | def test_where_inplace_casting(data): |
948 | 943 | # GH 22051 |
@@ -1023,19 +1018,18 @@ def test_where_producing_ea_cond_for_np_dtype(): |
1023 | 1018 | tm.assert_frame_equal(result, expected) |
1024 | 1019 |
|
1025 | 1020 |
|
1026 | | -@pytest.mark.xfail( |
1027 | | - using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)", strict=False |
1028 | | -) |
1029 | 1021 | @pytest.mark.parametrize( |
1030 | 1022 | "replacement", [0.001, True, "snake", None, datetime(2022, 5, 4)] |
1031 | 1023 | ) |
1032 | | -def test_where_int_overflow(replacement, using_infer_string, request): |
| 1024 | +def test_where_int_overflow(replacement, using_infer_string): |
1033 | 1025 | # GH 31687 |
1034 | 1026 | df = DataFrame([[1.0, 2e25, "nine"], [np.nan, 0.1, None]]) |
1035 | 1027 | if using_infer_string and replacement not in (None, "snake"): |
1036 | | - request.node.add_marker( |
1037 | | - pytest.mark.xfail(reason="Can't set non-string into string column") |
1038 | | - ) |
| 1028 | + with pytest.raises( |
| 1029 | + TypeError, match="Cannot set non-string value|Scalar must be NA or str" |
| 1030 | + ): |
| 1031 | + df.where(pd.notnull(df), replacement) |
| 1032 | + return |
1039 | 1033 | result = df.where(pd.notnull(df), replacement) |
1040 | 1034 | expected = DataFrame([[1.0, 2e25, "nine"], [replacement, 0.1, replacement]]) |
1041 | 1035 |
|
|
0 commit comments