File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -156,11 +156,15 @@ def _repr_html_(self) -> str:
156
156
# Import here to avoid circular imports
157
157
from datafusion .html_formatter import get_formatter
158
158
159
- # Always get the latest formatter
159
+ # Always get the latest formatter instance
160
160
formatter = get_formatter ()
161
161
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 )
164
168
165
169
def describe (self ) -> DataFrame :
166
170
"""Return the statistics for this DataFrame.
Original file line number Diff line number Diff line change @@ -661,8 +661,20 @@ def reset_formatter():
661
661
"""Reset the HTML formatter after each test."""
662
662
from datafusion .html_formatter import configure_formatter
663
663
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
+
664
672
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
666
678
667
679
668
680
def test_html_formatter_configuration (df , reset_formatter ):
You can’t perform that action at this time.
0 commit comments