@@ -1271,7 +1271,7 @@ def test_display_config(df):
1271
1271
assert config .max_table_bytes == 2 * 1024 * 1024 # 2 MB
1272
1272
assert config .min_table_rows == 20
1273
1273
assert config .max_cell_length == 25
1274
- assert config .max_table_rows_in_repr == 10 # Verify the new property
1274
+ assert config .max_table_rows_in_repr == 10
1275
1275
1276
1276
1277
1277
def test_configure_display (df ):
@@ -1281,7 +1281,7 @@ def test_configure_display(df):
1281
1281
max_table_bytes = 1024 * 1024 ,
1282
1282
min_table_rows = 10 ,
1283
1283
max_cell_length = 50 ,
1284
- max_table_rows_in_repr = 15 , # Add test for the new property
1284
+ max_table_rows_in_repr = 15 ,
1285
1285
)
1286
1286
1287
1287
# Verify the changes took effect
@@ -1299,7 +1299,7 @@ def test_configure_display(df):
1299
1299
assert config .max_cell_length == 50 # previous value retained
1300
1300
assert config .max_table_rows_in_repr == 5 # only this value changed
1301
1301
1302
- # Test with extreme values (still valid, but potentially problematic)
1302
+ # Test with extreme values
1303
1303
# Zero values
1304
1304
with pytest .raises (ValueError , match = r".*must be greater than 0.*" ):
1305
1305
df .configure_display (max_table_bytes = 0 , min_table_rows = 0 , max_cell_length = 0 )
@@ -1324,12 +1324,18 @@ def test_reset_display_config(df):
1324
1324
"""Test resetting display configuration to defaults."""
1325
1325
# First modify the configuration
1326
1326
df .configure_display (
1327
- max_table_bytes = 1024 * 1024 , min_table_rows = 10 , max_cell_length = 50
1327
+ max_table_bytes = 1024 * 1024 ,
1328
+ min_table_rows = 10 ,
1329
+ max_cell_length = 50 ,
1330
+ max_table_rows_in_repr = 15 ,
1328
1331
)
1329
1332
1330
1333
# Verify changes took effect
1331
1334
config = df .display_config
1332
1335
assert config .max_table_bytes == 1024 * 1024
1336
+ assert config .min_table_rows == 10
1337
+ assert config .max_cell_length == 50
1338
+ assert config .max_table_rows_in_repr == 15
1333
1339
1334
1340
# Now reset to defaults
1335
1341
df .reset_display_config ()
@@ -1339,6 +1345,7 @@ def test_reset_display_config(df):
1339
1345
assert config .max_table_bytes == 2 * 1024 * 1024 # 2 MB
1340
1346
assert config .min_table_rows == 20
1341
1347
assert config .max_cell_length == 25
1348
+ assert config .max_table_rows_in_repr == 10
1342
1349
1343
1350
1344
1351
def test_min_table_rows_display (ctx ):
@@ -1428,11 +1435,11 @@ def test_max_cell_length_display(ctx):
1428
1435
def test_display_config_repr_string (ctx ):
1429
1436
"""Test that __repr__ respects display configuration."""
1430
1437
# Create a dataframe with more rows than we want to show
1431
- # df.__repr__ returns max 10 rows, so we start test with 7 rows
1438
+ # df.__repr__ returns max 10 rows by default , so we start test with 7 rows
1432
1439
rows = 7
1433
1440
df = _create_numeric_test_df (ctx , rows )
1434
1441
1435
- # Configure to show only 5 rows in string representation
1442
+ # Configure to show at least 5 rows in string representation
1436
1443
min_table_rows_in_display = 5
1437
1444
df .configure_display (min_table_rows = min_table_rows_in_display )
1438
1445
@@ -1442,8 +1449,6 @@ def test_display_config_repr_string(ctx):
1442
1449
# Count the number of rows using helper function
1443
1450
lines_count = _count_lines_in_str (repr_str )
1444
1451
1445
- # Should be fewer rows than the total
1446
- assert lines_count <= rows
1447
1452
assert lines_count >= min_table_rows_in_display
1448
1453
1449
1454
# Now set min_rows higher and see if more rows appear
0 commit comments