Skip to content

Commit 08d9ede

Browse files
committed
no-infer-string build
1 parent b107913 commit 08d9ede

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

pandas/tests/extension/test_string.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,16 @@ def test_compare_scalar(self, data, comparison_op):
229229
def test_groupby_extension_apply(self, data_for_grouping, groupby_apply_op):
230230
super().test_groupby_extension_apply(data_for_grouping, groupby_apply_op)
231231

232+
def test_combine_add(self, data_repeated, using_infer_string, request):
233+
dtype = next(data_repeated(1)).dtype
234+
if not using_infer_string and dtype.storage == "python":
235+
mark = pytest.mark.xfail(
236+
reason="The pointwise operation result will be inferred to "
237+
"string[nan, pyarrow], which does not match the input dtype"
238+
)
239+
request.applymarker(mark)
240+
super().test_combine_add(data_repeated)
241+
232242
def test_arith_series_with_array(
233243
self, data, all_arithmetic_operators, using_infer_string, request
234244
):

pandas/tests/indexes/test_any_index.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from pandas.errors import InvalidIndexError
1111

12+
from pandas import StringDtype
1213
import pandas._testing as tm
1314

1415

@@ -36,8 +37,15 @@ def test_mutability(index):
3637

3738

3839
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
39-
def test_map_identity_mapping(index, request):
40+
def test_map_identity_mapping(index, request, using_infer_string):
4041
# GH#12766
42+
if (
43+
not using_infer_string
44+
and isinstance(index.dtype, StringDtype)
45+
and index.dtype.storage == "python"
46+
):
47+
mark = pytest.mark.xfail(reason="Does not preserve dtype")
48+
request.applymarker(mark)
4149

4250
result = index.map(lambda x: x)
4351
if index.dtype == object and (result.dtype == bool or result.dtype == "string"):

pandas/tests/indexes/test_base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,19 @@ def test_map_dictlike_simple(self, mapper):
581581
],
582582
)
583583
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
584-
def test_map_dictlike(self, index, mapper, request):
584+
def test_map_dictlike(self, index, mapper, request, using_infer_string):
585585
# GH 12756
586586
if isinstance(index, CategoricalIndex):
587587
pytest.skip("Tested in test_categorical")
588588
elif not index.is_unique:
589589
pytest.skip("Cannot map duplicated index")
590+
if (
591+
not using_infer_string
592+
and isinstance(index.dtype, pd.StringDtype)
593+
and index.dtype.storage == "python"
594+
):
595+
mark = pytest.mark.xfail(reason="map does not retain dtype")
596+
request.applymarker(mark)
590597

591598
rng = np.arange(len(index), 0, -1, dtype=np.int64)
592599

0 commit comments

Comments
 (0)