Skip to content

Commit 66d4d75

Browse files
committed
refactor: Remove max_cell_length from test_session_with_display_config and related tests
1 parent 5318811 commit 66d4d75

1 file changed

Lines changed: 5 additions & 32 deletions

File tree

python/tests/test_dataframe.py

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ def test_session_with_display_config(data):
110110

111111
# Create a new context with custom display config
112112
ctx2 = ctx.with_display_config(
113-
max_table_bytes=1024,
114-
min_table_rows=5,
115-
max_cell_length=10,
116-
max_table_rows_in_repr=3,
113+
min_table_rows=5, # default 20
114+
max_table_rows_in_repr=3, #default 10
117115
)
118116

119117
# Create a dataframe with the same data but using the new context
@@ -123,9 +121,9 @@ def test_session_with_display_config(data):
123121
# The HTML representation should be different with different display configs
124122
assert html_repr != html_repr2
125123

126-
# Check that the second representation has the short cell data based on the configured length
127-
assert f"<span class='expandable' id=" in html_repr2
128-
assert f'>{("x" * 10)}</span>' in html_repr2
124+
# Check that the second representation has only 3 rows
125+
assert len(re.findall("<tr>", html_repr2)) == 3 + 1 # +1 for the header row
126+
129127

130128

131129
def test_display_config_in_init(data, clean_formatter_state):
@@ -1780,31 +1778,6 @@ def test_display_config_affects_repr(data):
17801778
assert "Data truncated" not in repr_str2
17811779

17821780

1783-
def test_display_config_affects_html_repr(data, clean_formatter_state):
1784-
# Create a context with custom display config to show only a small cell length
1785-
ctx = SessionContext().with_display_config(max_cell_length=5)
1786-
1787-
# Create a DataFrame with a column containing long strings
1788-
df = ctx.from_pylist(data)
1789-
1790-
# Get the HTML representation
1791-
html_str = df._repr_html_()
1792-
1793-
# The cell should be truncated to 5 characters and have expansion button
1794-
assert ">xxxxx" in html_str # 5 character limit
1795-
expandable_class = '.expandable-container'
1796-
assert expandable_class in html_str
1797-
1798-
# Create a context with larger cell length limit
1799-
ctx2 = SessionContext().with_display_config(max_cell_length=60)
1800-
1801-
df2 = ctx2.from_pylist(data)
1802-
html_str2 = df2._repr_html_()
1803-
1804-
# String shouldn't be truncated (or at least not in the same way)
1805-
assert expandable_class not in html_str2
1806-
1807-
18081781
def test_display_config_rows_limit_in_html(data):
18091782
max_table_rows = 5
18101783
# Create a context with custom display config to limit rows

0 commit comments

Comments
 (0)