File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,11 +156,15 @@ def _repr_html_(self) -> str:
156156 # Import here to avoid circular imports
157157 from datafusion .html_formatter import get_formatter
158158
159- # Always get the latest formatter
159+ # Always get the latest formatter instance
160160 formatter = get_formatter ()
161161
162- # Format the data using the latest formatter
163- return formatter .format_html (self .collect (), self .schema ())
162+ # Get data and schema
163+ batches = self .collect ()
164+ schema = self .schema ()
165+
166+ # Format the data using our formatter
167+ return formatter .format_html (batches , schema )
164168
165169 def describe (self ) -> DataFrame :
166170 """Return the statistics for this DataFrame.
Original file line number Diff line number Diff line change @@ -661,8 +661,20 @@ def reset_formatter():
661661 """Reset the HTML formatter after each test."""
662662 from datafusion .html_formatter import configure_formatter
663663
664+ # Store original formatter configuration
665+ from datafusion .html_formatter import _default_formatter
666+
667+ original = _default_formatter
668+
669+ # Give the test a fresh formatter
670+ configure_formatter ()
671+
664672 yield
665- configure_formatter () # Reset to defaults after test
673+
674+ # Completely reset to original state after test
675+ from datafusion .html_formatter import _default_formatter
676+
677+ globals ()["_default_formatter" ] = original
666678
667679
668680def test_html_formatter_configuration (df , reset_formatter ):
You can’t perform that action at this time.
0 commit comments