Skip to content

Commit 0bee1ac

Browse files
update tests and remove xfails
1 parent c005778 commit 0bee1ac

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

pandas/tests/arrays/string_/test_string_arrow.py

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

7-
from pandas.compat import HAS_PYARROW
87
import pandas.util._test_decorators as td
98

109
import pandas as pd
@@ -27,20 +26,14 @@ def test_eq_all_na():
2726
tm.assert_extension_array_equal(result, expected)
2827

2928

30-
def test_config(string_storage, request, using_infer_string):
31-
if using_infer_string and string_storage == "python" and HAS_PYARROW:
32-
# string storage with na_value=NaN always uses pyarrow if available
33-
# -> does not yet honor the option
34-
request.applymarker(pytest.mark.xfail(reason="TODO(infer_string)"))
35-
29+
def test_config(string_storage):
3630
with pd.option_context("string_storage", string_storage):
3731
assert StringDtype().storage == string_storage
3832
result = pd.array(["a", "b"])
3933
assert result.dtype.storage == string_storage
4034

41-
dtype = StringDtype(
42-
string_storage, na_value=np.nan if using_infer_string else pd.NA
43-
)
35+
# pd.array(..) by default always returns the NA-variant
36+
dtype = StringDtype(string_storage, na_value=pd.NA)
4437
expected = dtype.construct_array_type()._from_sequence(["a", "b"], dtype=dtype)
4538
tm.assert_equal(result, expected)
4639

pandas/tests/base/test_value_counts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def test_value_counts_inferred(index_or_series, using_infer_string):
114114
else:
115115
exp = np.unique(np.array(s_values, dtype=np.object_))
116116
if using_infer_string:
117-
exp = array(exp)
117+
exp = array(exp, dtype="str")
118118
tm.assert_equal(s.unique(), exp)
119119

120120
assert s.nunique() == 4
@@ -192,7 +192,7 @@ def test_value_counts_bins(index_or_series, using_infer_string):
192192
else:
193193
exp = np.array(["a", "b", np.nan, "d"], dtype=object)
194194
if using_infer_string:
195-
exp = array(exp)
195+
exp = array(exp, dtype="str")
196196
tm.assert_equal(s.unique(), exp)
197197
assert s.nunique() == 3
198198

pandas/tests/dtypes/cast/test_construct_ndarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_construct_1d_ndarray_preserving_na(
2121
):
2222
result = sanitize_array(values, index=None, dtype=dtype)
2323
if using_infer_string and expected.dtype == object and dtype is None:
24-
tm.assert_extension_array_equal(result, pd.array(expected))
24+
tm.assert_extension_array_equal(result, pd.array(expected, dtype="str"))
2525
else:
2626
tm.assert_numpy_array_equal(result, expected)
2727

pandas/tests/io/parser/usecols/test_usecols_basic.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import numpy as np
99
import pytest
1010

11-
from pandas._config import using_string_dtype
12-
1311
from pandas.errors import ParserError
1412

1513
from pandas import (
@@ -531,7 +529,6 @@ def test_usecols_additional_columns_integer_columns(all_parsers):
531529
tm.assert_frame_equal(result, expected)
532530

533531

534-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
535532
def test_usecols_dtype(all_parsers):
536533
parser = all_parsers
537534
data = """

0 commit comments

Comments
 (0)