8000 Reorganize tests · kosiew/datafusion-python@620d25e · GitHub
[go: up one dir, main page]

Skip to content

Commit 620d25e

Browse files
committed
Reorganize tests
1 parent c10d7eb commit 620d25e

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

python/tests/test_dataframe.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ def test_html_formatter_manual_format_html(clean_formatter_state):
16491649
assert "<style>" in local_html_2
16501650

16511651

1652-
def test_html_formatter_memory_and_row_parameters():
1652+
def test_html_formatter_memory_and_rows():
16531653
"""Test the memory and row control parameters in DataFrameHtmlFormatter."""
16541654

16551655
# Test default values
@@ -1667,26 +1667,20 @@ def test_html_formatter_memory_and_row_parameters():
16671667
assert formatter.max_memory_bytes == 1024 * 1024
16681668
assert formatter.min_rows_display == 10
16691669
assert formatter.repr_rows == 5
1670-
1671-
1672-
def test_html_formatter_memory_and_row_validation():
1673-
"""Test validation for the memory and row control parameters in DataFrameHtmlFormatter."""
16741670

1675-
# Test invalid max_memory_bytes
1671+
# Test validation for invalid parameters
16761672
with pytest.raises(ValueError, match="max_memory_bytes must be a positive integer"):
16771673
DataFrameHtmlFormatter(max_memory_bytes=0)
16781674

16791675
with pytest.raises(ValueError, match="max_memory_bytes must be a positive integer"):
16801676
DataFrameHtmlFormatter(max_memory_bytes=-100)
16811677

1682-
# Test invalid min_rows_display
16831678
with pytest.raises(ValueError, match="min_rows_display must be a positive integer"):
16841679
DataFrameHtmlFormatter(min_rows_display=0)
16851680

16861681
with pytest.raises(ValueError, match="min_rows_display must be a positive integer"):
16871682
DataFrameHtmlFormatter(min_rows_display=-5)
16881683

1689-
# Test invalid repr_rows
16901684
with pytest.raises(ValueError, match="repr_rows must be a positive integer"):
16911685
DataFrameHtmlFormatter(repr_rows=0)
16921686

@@ -1710,7 +1704,20 @@ def get_header_style(self) -> str:
17101704
"padding: 10px; border: 1px solid #3367d6;"
17111705
)
17121706

1713-
# Configure with custom style provider and memory/row parameters
1707+
# Configure with custom style provider
1708+
configure_formatter(style_provider=CustomStyleProvider())
1709+
1710+
html_output = df._repr_html_()
1711+
1712+
# Verify our custom styles were applied
1713+
assert "background-color: #4285f4" in html_output
1714+
assert "color: white" in html_output
1715+
assert "background-color: #f5f5f5" in html_output
1716+
1717+
# Reset for the next part of the test
1718+
reset_formatter()
1719+
1720+
# Configure with custom style provider and additional parameters
17141721
configure_formatter(
17151722
style_provider=CustomStyleProvider(),
17161723
max_memory_bytes=3 * 1024 * 1024, # 3 MB
@@ -1725,7 +1732,7 @@ def get_header_style(self) -> str:
17251732
assert "color: white" in html_output
17261733
assert "background-color: #f5f5f5" in html_output
17271734

1728-
# Test memory and row parameters
1735+
# Test memory and row parameters were properly set
17291736
formatter = get_formatter()
17301737
assert formatter.max_memory_bytes == 3 * 1024 * 1024 # 3 MB
17311738
assert formatter.min_rows_display == 15

0 commit comments

Comments
 (0)
0