Skip to content

Commit 2b91410

Browse files
committed
fix tests
1 parent b7edf80 commit 2b91410

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

pandas/tests/io/formats/style/test_format.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def test_1level_multiindex():
335335
midx = MultiIndex.from_product([[1, 2]], names=[""])
336336
df = DataFrame(-1, index=midx, columns=[0, 1])
337337
ctx = df.style._translate(True, True)
338-
assert ctx["body"][0][0]["display_value"] == 1
338+
assert ctx["body"][0][0]["display_value"] == "1"
339339
assert ctx["body"][0][0]["is_visible"] is True
340-
assert ctx["body"][1][0]["display_value"] == 2
340+
assert ctx["body"][1][0]["display_value"] == "2"
341341
assert ctx["body"][1][0]["is_visible"] is True

pandas/tests/io/formats/style/test_style.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def mi_styler_comp(mi_styler):
5454
mi_styler.hide_index(names=True)
5555
mi_styler.set_table_attributes('class="box"')
5656
mi_styler.format(na_rep="MISSING", precision=3)
57+
mi_styler.format_index(precision=2, axis=0)
58+
mi_styler.format_index(precision=4, axis=1)
5759
mi_styler.highlight_max(axis=None)
5860
mi_styler.applymap_index(lambda x: "color: white;", axis=0)
5961
mi_styler.applymap_index(lambda x: "color: black;", axis=1)
@@ -1051,31 +1053,31 @@ def test_mi_sparse_column_names(self):
10511053
},
10521054
{
10531055
"class": "col_heading level1 col0",
1054-
"display_value": 1,
1056+
"display_value": "1",
10551057
"is_visible": True,
10561058
"type": "th",
10571059
"value": 1,
10581060
"attributes": "",
10591061
},
10601062
{
10611063
"class": "col_heading level1 col1",
1062-
"display_value": 0,
1064+
"display_value": "0",
10631065
"is_visible": True,
10641066
"type": "th",
10651067
"value": 0,
10661068
"attributes": "",
10671069
},
10681070
{
10691071
"class": "col_heading level1 col2",
1070-
"display_value": 1,
1072+
"display_value": "1",
10711073
"is_visible": True,
10721074
"type": "th",
10731075
"value": 1,
10741076
"attributes": "",
10751077
},
10761078
{
10771079
"class": "col_heading level1 col3",
1078-
"display_value": 0,
1080+
"display_value": "0",
10791081
"is_visible": True,
10801082
"type": "th",
10811083
"value": 0,
@@ -1174,7 +1176,7 @@ def test_hide_columns_index_mult_levels(self):
11741176
# column headers
11751177
assert ctx["head"][0][2]["is_visible"]
11761178
assert ctx["head"][1][2]["is_visible"]
1177-
assert ctx["head"][1][3]["display_value"] == 1
1179+
assert ctx["head"][1][3]["display_value"] == "1"
11781180
# indices
11791181
assert ctx["body"][0][0]["is_visible"]
11801182
# data

0 commit comments

Comments
 (0)