1616import pytest
1717
1818import bigframes as bf
19- from bigframes .display import TableWidget
2019
2120pytest .importorskip ("anywidget" )
2221
@@ -52,13 +51,15 @@ def paginated_bf_df(
5251
5352
5453@pytest .fixture (scope = "module" )
55- def table_widget (paginated_bf_df : bf .dataframe .DataFrame ) -> TableWidget :
54+ def table_widget (paginated_bf_df : bf .dataframe .DataFrame ):
5655 """
5756 Helper fixture to create a TableWidget instance with a fixed page size.
5857 This reduces duplication across tests that use the same widget configuration.
5958 """
59+ from bigframes import display
60+
6061 with bf .option_context ("display.repr_mode" , "anywidget" , "display.max_rows" , 2 ):
61- widget = TableWidget (paginated_bf_df )
62+ widget = display . TableWidget (paginated_bf_df )
6263 return widget
6364
6465
@@ -89,9 +90,9 @@ def test_repr_anywidget_initialization_sets_page_to_zero(
8990):
9091 """A TableWidget should initialize with the page number set to 0."""
9192 with bf .option_context ("display.repr_mode" , "anywidget" ):
92- from bigframes . display import TableWidget
93+ from bigframes import display
9394
94- widget = TableWidget (paginated_bf_df )
95+ widget = display . TableWidget (paginated_bf_df )
9596
9697 assert widget .page == 0
9798
@@ -101,9 +102,9 @@ def test_repr_anywidget_initialization_sets_page_size_from_options(
101102):
102103 """A TableWidget should initialize its page size from bf.options."""
103104 with bf .option_context ("display.repr_mode" , "anywidget" ):
104- from bigframes . display import TableWidget
105+ from bigframes import display
105106
106- widget = TableWidget (paginated_bf_df )
107+ widget = display . TableWidget (paginated_bf_df )
107108
108109 assert widget .page_size == bf .options .display .max_rows
109110
@@ -114,15 +115,15 @@ def test_repr_anywidget_initialization_sets_row_count(
114115):
115116 """A TableWidget should initialize with the correct total row count."""
116117 with bf .option_context ("display.repr_mode" , "anywidget" ):
117- from bigframes . display import TableWidget
118+ from bigframes import display
118119
119- widget = TableWidget (paginated_bf_df )
120+ widget = display . TableWidget (paginated_bf_df )
120121
121122 assert widget .row_count == len (paginated_pandas_df )
122123
123124
124125def test_repr_anywidget_display_first_page_on_load (
125- table_widget : TableWidget , paginated_pandas_df : pd .DataFrame
126+ table_widget , paginated_pandas_df : pd .DataFrame
126127):
127128 """
128129 Given a widget, when it is first loaded, then it should display
@@ -136,7 +137,7 @@ def test_repr_anywidget_display_first_page_on_load(
136137
137138
138139def test_repr_anywidget_navigate_to_second_page (
139- table_widget : TableWidget , paginated_pandas_df : pd .DataFrame
140+ table_widget , paginated_pandas_df : pd .DataFrame
140141):
141142 """
142143 Given a widget, when the page is set to 1, then it should display
@@ -152,7 +153,7 @@ def test_repr_anywidget_navigate_to_second_page(
152153
153154
154155def test_repr_anywidget_navigate_to_last_page (
155- table_widget : TableWidget , paginated_pandas_df : pd .DataFrame
156+ table_widget , paginated_pandas_df : pd .DataFrame
156157):
157158 """
158159 Given a widget, when the page is set to the last page (2),
@@ -168,7 +169,7 @@ def test_repr_anywidget_navigate_to_last_page(
168169
169170
170171def test_repr_anywidget_page_clamp_to_zero_for_negative_input (
171- table_widget : TableWidget , paginated_pandas_df : pd .DataFrame
172+ table_widget , paginated_pandas_df : pd .DataFrame
172173):
173174 """
174175 Given a widget, when a negative page number is set,
@@ -184,7 +185,7 @@ def test_repr_anywidget_page_clamp_to_zero_for_negative_input(
184185
185186
186187def test_repr_anywidget_page_clamp_to_last_page_for_out_of_bounds_input (
187- table_widget : TableWidget , paginated_pandas_df : pd .DataFrame
188+ table_widget , paginated_pandas_df : pd .DataFrame
188189):
189190 """
190191 Given a widget, when a page number greater than the max is set,
0 commit comments