@@ -888,6 +888,30 @@ def test_join_repr(scalars_dfs_maybe_ordered):
888
888
assert actual == expected
889
889
890
890
891
+ def test_repr_w_display_options (scalars_dfs , session ):
892
+ metrics = session ._metrics
893
+ scalars_df , _ = scalars_dfs
894
+ # get a pandas df of the expected format
895
+ df , _ = scalars_df ._block .to_pandas ()
896
+ pandas_df = df .set_axis (scalars_df ._block .column_labels , axis = 1 )
897
+ pandas_df .index .name = scalars_df .index .name
898
+
899
+ executions_pre = metrics .execution_count
900
+ with bigframes .option_context (
901
+ "display.max_rows" , 10 , "display.max_columns" , 5 , "display.max_colwidth" , 10
902
+ ):
903
+
904
+ # When there are 10 or fewer rows, the outputs should be identical except for the extra note.
905
+ actual = scalars_df .head (10 ).__repr__ ()
906
+ executions_post = metrics .execution_count
907
+
908
+ with display_options .pandas_repr (bigframes .options .display ):
909
+ pandas_repr = pandas_df .head (10 ).__repr__ ()
910
+
911
+ assert actual == pandas_repr
912
+ assert (executions_post - executions_pre ) <= 3
913
+
914
+
891
915
def test_repr_html_w_all_rows (scalars_dfs , session ):
892
916
metrics = session ._metrics
893
917
scalars_df , _ = scalars_dfs
0 commit comments