File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 5555import pyarrow
5656import tabulate
5757
58+ import bigframes
5859import bigframes ._config .display_options as display_options
5960import bigframes .constants
6061import bigframes .core
@@ -951,6 +952,10 @@ def _repr_html_(self):
951952 Renders the DataFrame as HTML.
952953 This method is used by IPython to display the DataFrame.
953954 """
955+ # If in anywidget mode, return None to defer to _repr_mimebundle_
956+ # which will provide the richer anywidget representation.
957+ if bigframes .options .display .repr_mode == "anywidget" :
958+ return None
954959 return self ._repr_mimebundle_ ()["text/html" ]
955960
956961 def _create_html_representation (
Original file line number Diff line number Diff line change @@ -930,6 +930,12 @@ def test_repr_in_anywidget_mode_should_not_be_deferred(
930930 assert "page_1_row_1" in representation
931931
932932
933+ def test_dataframe_repr_html_anywidget_mode (paginated_bf_df : bf .dataframe .DataFrame ):
934+ with bf .option_context ("display.repr_mode" , "anywidget" ):
935+ result = paginated_bf_df ._repr_html_ ()
936+ assert result is None
937+
938+
933939# TODO(b/332316283): Add tests for custom index and multiindex
934940# This may not be necessary for the SQL Cell use case but should be
935941# considered for completeness.
You can’t perform that action at this time.
0 commit comments