Skip to content

TST (string): more targeted xfails in test_string.py #59703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions pandas/tests/extension/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import numpy as np
import pytest

from pandas._config import using_string_dtype
from pandas.compat import HAS_PYARROW

import pandas as pd
import pandas._testing as tm
Expand All @@ -31,10 +31,6 @@
from pandas.core.arrays.string_ import StringDtype
from pandas.tests.extension import base

pytestmark = pytest.mark.xfail(
using_string_dtype(), reason="TODO(infer_string)", strict=False
)


def maybe_split_array(arr, chunked):
if not chunked:
Expand Down Expand Up @@ -217,6 +213,36 @@ def test_compare_scalar(self, data, comparison_op):
def test_groupby_extension_apply(self, data_for_grouping, groupby_apply_op):
super().test_groupby_extension_apply(data_for_grouping, groupby_apply_op)

def test_combine_add(self, data_repeated, using_infer_string, request):
dtype = next(data_repeated(1)).dtype
if using_infer_string and (
(dtype.na_value is pd.NA) and dtype.storage == "python"
):
mark = pytest.mark.xfail(
reason="The pointwise operation result will be inferred to "
"string[nan, pyarrow], which does not match the input dtype"
)
request.applymarker(mark)
super().test_combine_add(data_repeated)

def test_arith_series_with_array(
self, data, all_arithmetic_operators, using_infer_string, request
):
dtype = data.dtype
if (
using_infer_string
and all_arithmetic_operators == "__radd__"
and (
(dtype.na_value is pd.NA) or (dtype.storage == "python" and HAS_PYARROW)
)
):
mark = pytest.mark.xfail(
reason="The pointwise operation result will be inferred to "
"string[nan, pyarrow], which does not match the input dtype"
)
request.applymarker(mark)
super().test_arith_series_with_array(data, all_arithmetic_operators)


class Test2DCompat(base.Dim2CompatTests):
@pytest.fixture(autouse=True)
Expand Down
Loading