Skip to content

Commit aa8101d

Browse files
committed
Precommit
1 parent 4f13c05 commit aa8101d

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

pandas/tests/io/formats/test_to_excel.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
"""Tests formatting as writer-agnostic ExcelCells"""
22

3-
import numpy as np
4-
53
import string
4+
from unittest.mock import (
5+
Mock,
6+
call,
7+
patch,
8+
)
69

10+
import numpy as np
711
import pytest
812

13+
from pandas.errors import CSSWarning
14+
915
from pandas import (
1016
DataFrame,
1117
Index,
1218
MultiIndex,
19+
NaT,
1320
Timestamp,
14-
NaT
1521
)
16-
from pandas.errors import CSSWarning
17-
1822
import pandas._testing as tm
1923

2024
from pandas.io.formats.excel import (
@@ -23,10 +27,8 @@
2327
ExcelCell,
2428
ExcelFormatter,
2529
)
26-
2730
from pandas.io.formats.style import Styler
2831

29-
from unittest.mock import Mock, patch, call
3032

3133
@pytest.mark.parametrize(
3234
"css,expected",
@@ -581,7 +583,7 @@ def test_format_value_handles_na(self, val, na_rep, expected):
581583
formatter = ExcelFormatter(df, na_rep=na_rep)
582584
result = formatter._format_value(val)
583585
assert result == expected
584-
586+
585587
@pytest.mark.parametrize(
586588
"val, float_format, inf_rep, expected",
587589
[
@@ -626,7 +628,7 @@ def test_formated_header_mi_multi_index_throws(self):
626628
df = DataFrame(
627629
np.random.randn(4, 4),
628630
columns=columns
629-
)
631+
)
630632
formatter = ExcelFormatter(df, index=False)
631633
assert(formatter.columns.nlevels > 1 and not formatter.index)
632634
msg = (
@@ -635,13 +637,13 @@ def test_formated_header_mi_multi_index_throws(self):
635637
)
636638
with pytest.raises(NotImplementedError):
637639
list(formatter._format_header_mi())
638-
640+
639641
def test_returns_none_no_header(self):
640642
df = DataFrame({"A": [1,2], "B": [3,4]})
641643
formatter = ExcelFormatter(df,header=False)
642644
assert(formatter._has_aliases == False)
643645
assert(list(formatter._format_header_mi()) == list())
644-
646+
645647
@pytest.mark.parametrize(
646648
"df, merge_cells, expected_cells",
647649
[
@@ -840,7 +842,7 @@ def test_format_regular_rows_general(self, df, formatter_options, expected_cells
840842
for cell in result
841843
]
842844
assert result_tuples == expected_cells
843-
845+
844846
@pytest.mark.parametrize(
845847
"df, formatter_options, expected_cells",
846848
[
@@ -980,10 +982,10 @@ def test_generate_body_general(self, df, coloffset, rowcounter, expected_cells):
980982
"inf_rep": "Infinity",
981983
},
982984
[
983-
"A", # Column header
985+
"A", # Column header
984986
"idx", # Index header
985987
0, # Index value
986-
1, # Index value
988+
1, # Index value
987989
"NULL", # Formatted NaN
988990
1.23, # Formatted float
989991
],
@@ -1022,4 +1024,4 @@ def test_get_formatted_cells_integration(self, df, formatter_options, expected_v
10221024
result_values = [cell.val for cell in result]
10231025

10241026
assert result_values == expected_values
1025-
# Flatten the structure and check against expected formatted values
1027+
# Flatten the structure and check against expected formatted values

0 commit comments

Comments
 (0)