Skip to content
Merged
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
5 changes: 4 additions & 1 deletion packages/bigframes/tests/unit/display/test_render_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import unittest.mock as mock

import pytest

import bigframes.display.html as bf_html
import bigframes.pandas as bpd

Expand Down Expand Up @@ -63,7 +65,8 @@ def test_repr_mimebundle_selection_logic():
# Test fallback to static deferred repr when anywidget fails
mock_anywidget.side_effect = Exception("Anywidget failed")
with bpd.option_context("display.repr_mode", "deferred"):
bundle = bf_html.repr_mimebundle(mock_obj)
with pytest.warns(UserWarning, match="Anywidget mode is not available"):
bundle = bf_html.repr_mimebundle(mock_obj)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can chain multiple context managers in a single "with" statement, separated with commas:

with bpd.option_context(...), pytest.warns(...):
    bundle = ...

Let see if that works

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestions. I have applied the same changes to all anywidget related testcase. Thanks again for your suggestions.

assert bundle == {"text/plain": "deferred"}
mock_deferred.assert_called_once()

Expand Down
Loading