Skip to content

Commit fa5e835

Browse files
authored
TST: Additions/updates to tests (#56822)
* A test for Future warning in the applymap_index method of the style class * Minor modification changig pd.Dataframe to Dataframe * Minor modification in matching message * changed the apply_index method to applymap_index * Minor formatting adding extra space * Removed the docstring * modified the function passed into the the function been tested
1 parent d7ce2ce commit fa5e835

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

+12
Original file line numberDiff line numberDiff line change
@@ -1586,3 +1586,15 @@ def test_output_buffer(mi_styler, format):
15861586
# gh 47053
15871587
with tm.ensure_clean(f"delete_me.{format}") as f:
15881588
getattr(mi_styler, f"to_{format}")(f)
1589+
1590+
1591+
def test_deprecation_warning_for_usage_of_aaply_map_index_method_of_styler_object():
1592+
# 56717 https://github.com/pandas-dev/pandas/issues/56717
1593+
df = DataFrame([[1, 2], [3, 4]], index=["A", "B"])
1594+
msg = "Styler.applymap_index has been deprecated. Use Styler.map_index instead."
1595+
1596+
def color_b(s):
1597+
return "background-color:yellow;"
1598+
1599+
with tm.assert_produces_warning(FutureWarning, match=msg):
1600+
df.style.applymap_index(color_b, axis="columns")

0 commit comments

Comments
 (0)