Skip to content

Commit fb4f24e

Browse files
hippowmmroeschke
andauthored
TST: add test for dtype argument in str.decode (#61872)
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
1 parent 5e2fcb9 commit fb4f24e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/strings/test_strings.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Index,
1212
MultiIndex,
1313
Series,
14+
option_context,
1415
)
1516
import pandas._testing as tm
1617
from pandas.core.strings.accessor import StringMethods
@@ -778,3 +779,11 @@ def test_series_str_decode():
778779
result = Series([b"x", b"y"]).str.decode(encoding="UTF-8", errors="strict")
779780
expected = Series(["x", "y"], dtype="str")
780781
tm.assert_series_equal(result, expected)
782+
783+
784+
def test_decode_with_dtype_none():
785+
with option_context("future.infer_string", True):
786+
ser = Series([b"a", b"b", b"c"])
787+
result = ser.str.decode("utf-8", dtype=None)
788+
expected = Series(["a", "b", "c"], dtype="str")
789+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)