Skip to content

Commit 929563a

Browse files
committed
tidy up comments, tests
1 parent ee1de81 commit 929563a

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

python/tests/test_dataframe.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ def test_display_config(df):
12711271
assert config.max_table_bytes == 2 * 1024 * 1024 # 2 MB
12721272
assert config.min_table_rows == 20
12731273
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
12751275

12761276

12771277
def test_configure_display(df):
@@ -1281,7 +1281,7 @@ def test_configure_display(df):
12811281
max_table_bytes=1024 * 1024,
12821282
min_table_rows=10,
12831283
max_cell_length=50,
1284-
max_table_rows_in_repr=15, # Add test for the new property
1284+
max_table_rows_in_repr=15,
12851285
)
12861286

12871287
# Verify the changes took effect
@@ -1299,7 +1299,7 @@ def test_configure_display(df):
12991299
assert config.max_cell_length == 50 # previous value retained
13001300
assert config.max_table_rows_in_repr == 5 # only this value changed
13011301

1302-
# Test with extreme values (still valid, but potentially problematic)
1302+
# Test with extreme values
13031303
# Zero values
13041304
with pytest.raises(ValueError, match=r".*must be greater than 0.*"):
13051305
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):
13241324
"""Test resetting display configuration to defaults."""
13251325
# First modify the configuration
13261326
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,
13281331
)
13291332

13301333
# Verify changes took effect
13311334
config = df.display_config
13321335
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
13331339

13341340
# Now reset to defaults
13351341
df.reset_display_config()
@@ -1339,6 +1345,7 @@ def test_reset_display_config(df):
13391345
assert config.max_table_bytes == 2 * 1024 * 1024 # 2 MB
13401346
assert config.min_table_rows == 20
13411347
assert config.max_cell_length == 25
1348+
assert config.max_table_rows_in_repr == 10
13421349

13431350

13441351
def test_min_table_rows_display(ctx):
@@ -1428,11 +1435,11 @@ def test_max_cell_length_display(ctx):
14281435
def test_display_config_repr_string(ctx):
14291436
"""Test that __repr__ respects display configuration."""
14301437
# 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
14321439
rows = 7
14331440
df = _create_numeric_test_df(ctx, rows)
14341441

1435-
# Configure to show only 5 rows in string representation
1442+
# Configure to show at least 5 rows in string representation
14361443
min_table_rows_in_display = 5
14371444
df.configure_display(min_table_rows=min_table_rows_in_display)
14381445

@@ -1442,8 +1449,6 @@ def test_display_config_repr_string(ctx):
14421449
# Count the number of rows using helper function
14431450
lines_count = _count_lines_in_str(repr_str)
14441451

1445-
# Should be fewer rows than the total
1446-
assert lines_count <= rows
14471452
assert lines_count >= min_table_rows_in_display
14481453

14491454
# Now set min_rows higher and see if more rows appear

0 commit comments

Comments
 (0)