@@ -291,28 +291,28 @@ def test_widget_with_few_rows_should_have_only_one_page(small_widget):
291
291
assert small_widget .page == 0
292
292
293
293
294
- def test_widget_page_size_should_be_immutable_after_creation (
295
- paginated_bf_df : bf . dataframe . DataFrame ,
294
+ def test_widget_page_size_should_be_mutable_after_creation (
295
+ table_widget , paginated_pandas_df : pd . DataFrame
296
296
):
297
297
"""
298
- A widget's page size should be fixed on creation and not be affected
299
- by subsequent changes to global options.
298
+ A widget's page size can be changed after creation.
300
299
"""
301
- with bf .option_context ("display.repr_mode" , "anywidget" , "display.max_rows" , 2 ):
302
- from bigframes .display import TableWidget
303
-
304
- widget = TableWidget (paginated_bf_df )
305
- assert widget .page_size == 2
306
-
307
- # Navigate to second page to ensure widget is in a non-default state
308
- widget .page = 1
309
- assert widget .page == 1
300
+ # Check initial state
301
+ assert table_widget .page_size == 2
302
+ expected_slice = paginated_pandas_df .iloc [0 :2 ]
303
+ _assert_html_matches_pandas_slice (
304
+ table_widget .table_html , expected_slice , paginated_pandas_df
305
+ )
310
306
311
- # Change global max_rows - widget should not be affected
312
- bf .options .display .max_rows = 10
307
+ # Change page size
308
+ table_widget .page_size = 3
309
+ assert table_widget .page_size == 3
313
310
314
- assert widget .page_size == 2 # Should remain unchanged
315
- assert widget .page == 1 # Should remain on same page
311
+ # Check that the table content updates
312
+ expected_slice = paginated_pandas_df .iloc [0 :3 ]
313
+ _assert_html_matches_pandas_slice (
314
+ table_widget .table_html , expected_slice , paginated_pandas_df
315
+ )
316
316
317
317
318
318
def test_empty_widget_should_have_zero_row_count (empty_bf_df : bf .dataframe .DataFrame ):
0 commit comments