Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions pandas/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ def option_context(*args) -> Generator[None]:
)

ops = tuple(zip(args[::2], args[1::2], strict=True))
undo = ()
try:
undo = tuple((pat, get_option(pat)) for pat, val in ops)
for pat, val in ops:
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,9 @@ def test_no_silent_downcasting_deprecated():
cf.get_option("future.no_silent_downcasting")
with tm.assert_produces_warning(Pandas4Warning, match="is deprecated"):
cf.set_option("future.no_silent_downcasting", True)


def test_option_context_invalid_option():
with pytest.raises(OptionError, match="No such keys"):
with cf.option_context("invalid", True):
pass
Loading