|
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
|
@@ -985,9 +983,6 @@ def test_where_nullable_invalid_na(frame_or_series, any_numeric_ea_dtype):
|
985 | 983 | obj.mask(mask, null)
|
986 | 984 |
|
987 | 985 |
|
988 |
| -@pytest.mark.xfail( |
989 |
| - using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)" |
990 |
| -) |
991 | 986 | @given(data=OPTIONAL_ONE_OF_ALL)
|
992 | 987 | def test_where_inplace_casting(data):
|
993 | 988 | # GH 22051
|
@@ -1084,19 +1079,18 @@ def test_where_producing_ea_cond_for_np_dtype():
|
1084 | 1079 | tm.assert_frame_equal(result, expected)
|
1085 | 1080 |
|
1086 | 1081 |
|
1087 |
| -@pytest.mark.xfail( |
1088 |
| - using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)", strict=False |
1089 |
| -) |
1090 | 1082 | @pytest.mark.parametrize(
|
1091 | 1083 | "replacement", [0.001, True, "snake", None, datetime(2022, 5, 4)]
|
1092 | 1084 | )
|
1093 |
| -def test_where_int_overflow(replacement, using_infer_string, request): |
| 1085 | +def test_where_int_overflow(replacement, using_infer_string): |
1094 | 1086 | # GH 31687
|
1095 | 1087 | df = DataFrame([[1.0, 2e25, "nine"], [np.nan, 0.1, None]])
|
1096 | 1088 | if using_infer_string and replacement not in (None, "snake"):
|
1097 |
| - request.node.add_marker( |
1098 |
| - pytest.mark.xfail(reason="Can't set non-string into string column") |
1099 |
| - ) |
| 1089 | + with pytest.raises( |
| 1090 | + TypeError, match="Cannot set non-string value|Scalar must be NA or str" |
| 1091 | + ): |
| 1092 | + df.where(pd.notnull(df), replacement) |
| 1093 | + return |
1100 | 1094 | result = df.where(pd.notnull(df), replacement)
|
1101 | 1095 | expected = DataFrame([[1.0, 2e25, "nine"], [replacement, 0.1, replacement]])
|
1102 | 1096 |
|
|
0 commit comments