Skip to content
Merged
Changes from 2 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
10 changes: 10 additions & 0 deletions pandas/tests/strings/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Index,
MultiIndex,
Series,
option_context,
)
import pandas._testing as tm
from pandas.core.strings.accessor import StringMethods
Expand Down Expand Up @@ -778,3 +779,12 @@ def test_series_str_decode():
result = Series([b"x", b"y"]).str.decode(encoding="UTF-8", errors="strict")
expected = Series(["x", "y"], dtype="str")
tm.assert_series_equal(result, expected)


def test_decode_with_dtype_none():
# Ensure that future.infer_string is enabled
with option_context("future.infer_string", True):
ser = Series([b"a", b"b", b"c"]) # Use byte strings
result = ser.str.decode("utf-8", dtype=None)
expected = Series(["a", "b", "c"], dtype="str")
tm.assert_series_equal(result, expected)