@@ -919,13 +919,13 @@ def get_header_style(self) -> str:
919
919
920
920
def test_html_formatter_memory_and_rows ():
921
921
"""Test the memory and row control parameters in DataFrameHtmlFormatter."""
922
-
922
+
923
923
# Test default values
924
924
formatter = DataFrameHtmlFormatter ()
925
925
assert formatter .max_memory_bytes == 2 * 1024 * 1024 # 2 MB
926
926
assert formatter .min_rows_display == 20
927
927
assert formatter .repr_rows == 10
928
-
928
+
929
929
# Test custom values
930
930
formatter = DataFrameHtmlFormatter (
931
931
max_memory_bytes = 1024 * 1024 , # 1 MB
@@ -935,7 +935,7 @@ def test_html_formatter_memory_and_rows():
935
935
assert formatter .max_memory_bytes == 1024 * 1024
936
936
assert formatter .min_rows_display == 10
937
937
assert formatter .repr_rows == 5
938
-
938
+
939
939
# Test extremely large values and tiny values (edge cases)
940
940
# These should not raise exceptions
941
941
extreme_formatter = DataFrameHtmlFormatter (
@@ -946,29 +946,30 @@ def test_html_formatter_memory_and_rows():
946
946
assert extreme_formatter .max_memory_bytes == 10 * 1024 * 1024 * 1024
947
947
assert extreme_formatter .min_rows_display == 1
948
948
assert extreme_formatter .repr_rows == 1
949
-
949
+
950
950
# Test validation for invalid parameters
951
951
with pytest .raises (ValueError , match = "max_memory_bytes must be a positive integer" ):
952
952
DataFrameHtmlFormatter (max_memory_bytes = 0 )
953
-
953
+
954
954
with pytest .raises (ValueError , match = "max_memory_bytes must be a positive integer" ):
955
955
DataFrameHtmlFormatter (max_memory_bytes = - 100 )
956
-
956
+
957
957
with pytest .raises (ValueError , match = "min_rows_display must be a positive integer" ):
958
958
DataFrameHtmlFormatter (min_rows_display = 0 )
959
-
959
+
960
960
with pytest .raises (ValueError , match = "min_rows_display must be a positive integer" ):
961
961
DataFrameHtmlFormatter (min_rows_display = - 5 )
962
-
962
+
963
963
with pytest .raises (ValueError , match = "repr_rows must be a positive integer" ):
964
964
DataFrameHtmlFormatter (repr_rows = 0 )
965
-
965
+
966
966
with pytest .raises (ValueError , match = "repr_rows must be a positive integer" ):
967
967
DataFrameHtmlFormatter (repr_rows = - 10 )
968
968
969
969
970
- def test_html_formatter_custom_style_provider_with_parameters (df , clean_formatter_state ):
971
- """Test using custom style providers with the HTML formatter and configured parameters."""
970
+ def test_custom_style_provider_html_formatter (df , clean_formatter_state ):
971
+ """Test using custom style providers with the HTML formatter and configured
972
+ parameters."""
972
973
973
974
class CustomStyleProvider :
974
975
def get_cell_style (self ) -> str :
@@ -995,7 +996,7 @@ def get_header_style(self) -> str:
995
996
996
997
# Reset for the next part of the test
997
998
reset_formatter ()
998
-
999
+
999
1000
# Configure with custom style provider and additional parameters
1000
1001
configure_formatter (
1001
1002
style_provider = CustomStyleProvider (),
@@ -1747,4 +1748,4 @@ def test_html_formatter_manual_format_html(clean_formatter_state):
1747
1748
local_html_2 = local_formatter .format_html ([batch ], batch .schema )
1748
1749
1749
1750
assert "<style>" in local_html_1
1750
- assert "<style>" in local_html_2
1751
+ assert "<style>" in local_html_2
0 commit comments