Skip to content

Commit 6e8fb65

Browse files
committed
use option_context
1 parent b2c70c0 commit 6e8fb65

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pandas/tests/strings/test_strings.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Index,
1212
MultiIndex,
1313
Series,
14-
set_option,
14+
option_context,
1515
)
1616
import pandas._testing as tm
1717
from pandas.core.strings.accessor import StringMethods
@@ -783,8 +783,8 @@ def test_series_str_decode():
783783

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

0 commit comments

Comments
 (0)