Skip to content

Commit e29bd98

Browse files
committed
- modifying test cases
1 parent 4d0b132 commit e29bd98

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

pandas/tests/io/formats/test_style.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,10 @@ def f(x):
405405

406406
result = self.df.style.where(f, style1)._compute().ctx
407407
expected = {
408-
(r, c): [style1 if f(self.df.loc[row, col]) else ""]
408+
(r, c): [style1]
409409
for r, row in enumerate(self.df.index)
410410
for c, col in enumerate(self.df.columns)
411+
if f(self.df.loc[row, col])
411412
}
412413
assert result == expected
413414

@@ -966,7 +967,6 @@ def test_bar_align_mid_nans(self):
966967
"transparent 25.0%, #d65f5f 25.0%, "
967968
"#d65f5f 50.0%, transparent 50.0%)",
968969
],
969-
(1, 0): [""],
970970
(0, 1): [
971971
"width: 10em",
972972
" height: 80%",
@@ -994,7 +994,6 @@ def test_bar_align_zero_nans(self):
994994
"transparent 50.0%, #d65f5f 50.0%, "
995995
"#d65f5f 75.0%, transparent 75.0%)",
996996
],
997-
(1, 0): [""],
998997
(0, 1): [
999998
"width: 10em",
1000999
" height: 80%",
@@ -1091,7 +1090,7 @@ def test_format_with_bad_na_rep(self):
10911090
def test_highlight_null(self, null_color="red"):
10921091
df = pd.DataFrame({"A": [0, np.nan]})
10931092
result = df.style.highlight_null()._compute().ctx
1094-
expected = {(0, 0): [""], (1, 0): ["background-color: red"]}
1093+
expected = {(1, 0): ["background-color: red"]}
10951094
assert result == expected
10961095

10971096
def test_highlight_null_subset(self):
@@ -1104,9 +1103,7 @@ def test_highlight_null_subset(self):
11041103
.ctx
11051104
)
11061105
expected = {
1107-
(0, 0): [""],
11081106
(1, 0): ["background-color: red"],
1109-
(0, 1): [""],
11101107
(1, 1): ["background-color: green"],
11111108
}
11121109
assert result == expected
@@ -1219,17 +1216,13 @@ def test_highlight_max(self):
12191216
expected = {
12201217
(1, 0): ["background-color: yellow"],
12211218
(1, 1): ["background-color: yellow"],
1222-
(0, 1): [""],
1223-
(0, 0): [""],
12241219
}
12251220
assert result == expected
12261221

12271222
result = getattr(df.style, attr)(axis=1)._compute().ctx
12281223
expected = {
12291224
(0, 1): ["background-color: yellow"],
12301225
(1, 1): ["background-color: yellow"],
1231-
(0, 0): [""],
1232-
(1, 0): [""],
12331226
}
12341227
assert result == expected
12351228

0 commit comments

Comments
 (0)