Skip to content

Commit 2005a71

Browse files
more xfails specific for no pyarrow
1 parent 77b9949 commit 2005a71

22 files changed

+128
-13
lines changed

pandas/tests/apply/test_numba.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def test_numba_nonunique_unsupported(apply_axis):
104104

105105

106106
def test_numba_unsupported_dtypes(apply_axis):
107+
pytest.importorskip("pyarrow")
107108
f = lambda x: x
108109
df = DataFrame({"a": [1, 2], "b": ["a", "b"], "c": [4, 5]})
109110
df["c"] = df["c"].astype("double[pyarrow]")

pandas/tests/arrays/boolean/test_arithmetic.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import numpy as np
44
import pytest
55

6+
from pandas._config import using_string_dtype
7+
8+
from pandas.compat import HAS_PYARROW
9+
610
import pandas as pd
711
import pandas._testing as tm
812

@@ -90,6 +94,9 @@ def test_op_int8(left_array, right_array, opname):
9094
# -----------------------------------------------------------------------------
9195

9296

97+
@pytest.mark.xfail(
98+
using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)"
99+
)
93100
def test_error_invalid_values(data, all_arithmetic_operators, using_infer_string):
94101
# invalid ops
95102

pandas/tests/frame/indexing/test_where.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from pandas._config import using_string_dtype
88

9+
from pandas.compat import HAS_PYARROW
10+
911
from pandas.core.dtypes.common import is_scalar
1012

1113
import pandas as pd
@@ -1018,6 +1020,9 @@ def test_where_producing_ea_cond_for_np_dtype():
10181020
tm.assert_frame_equal(result, expected)
10191021

10201022

1023+
@pytest.mark.xfail(
1024+
using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)", strict=False
1025+
)
10211026
@pytest.mark.parametrize(
10221027
"replacement", [0.001, True, "snake", None, datetime(2022, 5, 4)]
10231028
)

pandas/tests/frame/methods/test_info.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pandas._config import using_string_dtype
1111

1212
from pandas.compat import (
13+
HAS_PYARROW,
1314
IS64,
1415
PYPY,
1516
)
@@ -520,7 +521,7 @@ def test_info_int_columns():
520521
assert result == expected
521522

522523

523-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
524+
@pytest.mark.xfail(using_string_dtype() and HAS_PYARROW, reason="TODO(infer_string)")
524525
def test_memory_usage_empty_no_warning():
525526
# GH#50066
526527
df = DataFrame(index=["a", "b"])

pandas/tests/frame/methods/test_rank.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
import numpy as np
77
import pytest
88

9+
from pandas._config import using_string_dtype
10+
911
from pandas._libs.algos import (
1012
Infinity,
1113
NegInfinity,
1214
)
15+
from pandas.compat import HAS_PYARROW
1316

1417
from pandas import (
1518
DataFrame,
@@ -464,9 +467,18 @@ def test_rank_inf_nans_na_option(
464467
],
465468
)
466469
def test_rank_object_first(
467-
self, frame_or_series, na_option, ascending, expected, using_infer_string
470+
self,
471+
request,
472+
frame_or_series,
473+
na_option,
474+
ascending,
475+
expected,
476+
using_infer_string,
468477
):
469478
obj = frame_or_series(["foo", "foo", None, "foo"])
479+
if using_string_dtype() and not HAS_PYARROW and isinstance(obj, Series):
480+
request.applymarker(pytest.mark.xfail(reason="TODO(infer_string)"))
481+
470482
result = obj.rank(method="first", na_option=na_option, ascending=ascending)
471483
expected = frame_or_series(expected)
472484
if using_infer_string and isinstance(obj, Series):

pandas/tests/frame/methods/test_value_counts.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import numpy as np
22
import pytest
33

4+
from pandas._config import using_string_dtype
5+
6+
from pandas.compat import HAS_PYARROW
7+
48
import pandas as pd
59
import pandas._testing as tm
610

@@ -132,6 +136,9 @@ def test_data_frame_value_counts_dropna_true(nulls_fixture):
132136
tm.assert_series_equal(result, expected)
133137

134138

139+
@pytest.mark.xfail(
140+
using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)"
141+
)
135142
def test_data_frame_value_counts_dropna_false(nulls_fixture):
136143
# GH 41334
137144
df = pd.DataFrame(

pandas/tests/frame/test_api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from pandas._config import using_string_dtype
99
from pandas._config.config import option_context
1010

11+
from pandas.compat import HAS_PYARROW
12+
1113
import pandas as pd
1214
from pandas import (
1315
DataFrame,
@@ -113,7 +115,9 @@ def test_not_hashable(self):
113115
with pytest.raises(TypeError, match=msg):
114116
hash(empty_frame)
115117

116-
@pytest.mark.xfail(using_string_dtype(), reason="surrogates not allowed")
118+
@pytest.mark.xfail(
119+
using_string_dtype() and HAS_PYARROW, reason="surrogates not allowed"
120+
)
117121
def test_column_name_contains_unicode_surrogate(self):
118122
# GH 25509
119123
colname = "\ud83d"

pandas/tests/frame/test_arithmetic.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
from pandas._config import using_string_dtype
1515

16+
from pandas.compat import HAS_PYARROW
17+
1618
import pandas as pd
1719
from pandas import (
1820
DataFrame,
@@ -1542,7 +1544,9 @@ def test_comparisons(self, simple_frame, float_frame, func):
15421544
with pytest.raises(ValueError, match=msg):
15431545
func(simple_frame, simple_frame[:2])
15441546

1545-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
1547+
@pytest.mark.xfail(
1548+
using_string_dtype() and HAS_PYARROW, reason="TODO(infer_string)"
1549+
)
15461550
def test_strings_to_numbers_comparisons_raises(self, compare_operators_no_eq_ne):
15471551
# GH 11565
15481552
df = DataFrame(

pandas/tests/frame/test_constructors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from pandas._config import using_string_dtype
2525

2626
from pandas._libs import lib
27+
from pandas.compat import HAS_PYARROW
2728
from pandas.compat.numpy import np_version_gt2
2829
from pandas.errors import IntCastingNaNError
2930

@@ -299,7 +300,7 @@ def test_constructor_dtype_nocast_view_2d_array(self):
299300
df2 = DataFrame(df.values, dtype=df[0].dtype)
300301
assert df2._mgr.blocks[0].values.flags.c_contiguous
301302

302-
@pytest.mark.xfail(using_string_dtype(), reason="conversion copies")
303+
@pytest.mark.xfail(using_string_dtype() and HAS_PYARROW, reason="conversion copies")
303304
def test_1d_object_array_does_not_copy(self):
304305
# https://github.com/pandas-dev/pandas/issues/39272
305306
arr = np.array(["a", "b"], dtype="object")

pandas/tests/frame/test_logical_ops.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
import numpy as np
55
import pytest
66

7+
from pandas._config import using_string_dtype
8+
9+
from pandas.compat import HAS_PYARROW
10+
711
from pandas import (
812
CategoricalIndex,
913
DataFrame,
@@ -96,6 +100,9 @@ def test_logical_ops_int_frame(self):
96100
res_ser = df1a_int["A"] | df1a_bool["A"]
97101
tm.assert_series_equal(res_ser, df1a_bool["A"])
98102

103+
@pytest.mark.xfail(
104+
using_string_dtype() and not HAS_PYARROW, reason="TODO(infer_string)"
105+
)
99106
def test_logical_ops_invalid(self, using_infer_string):
100107
# GH#5808
101108

0 commit comments

Comments
 (0)