Skip to content

Commit 034ae8f

Browse files
committed
Update test
1 parent aec3929 commit 034ae8f

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

tests/system/small/test_anywidget.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -291,28 +291,28 @@ def test_widget_with_few_rows_should_have_only_one_page(small_widget):
291291
assert small_widget.page == 0
292292

293293

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
296296
):
297297
"""
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.
300299
"""
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+
)
310306

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
313310

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+
)
316316

317317

318318
def test_empty_widget_should_have_zero_row_count(empty_bf_df: bf.dataframe.DataFrame):

0 commit comments

Comments
 (0)