Skip to content

Commit fb4c5fd

Browse files
committed
update test_formats.py
1 parent 14de22f commit fb4c5fd

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

pandas/tests/io/formats/test_format.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
option_context,
2727
read_csv,
2828
reset_option,
29-
set_option,
3029
)
3130

3231
from pandas.io.formats import printing
@@ -382,15 +381,10 @@ def test_repr_float_formatting_html_output(
382381
self, data, format_option, expected_values
383382
):
384383
if format_option is not None:
385-
set_option("display.float_format", format_option.format)
386-
387-
df = DataFrame(data)
388-
html_output = df._repr_html_()
389-
assert expected_values in html_output
390-
391-
# reset option
392-
if format_option is not None:
393-
reset_option("display.float_format")
384+
with option_context("display.float_format", format_option.format):
385+
df = DataFrame(data)
386+
html_output = df._repr_html_()
387+
assert expected_values in html_output
394388

395389
def test_str_max_colwidth(self):
396390
# GH 7856

0 commit comments

Comments
 (0)