Skip to content

TST: Additions/updates to tests #56822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
12 changes: 12 additions & 0 deletions pandas/tests/io/formats/style/test_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,3 +1586,15 @@ def test_output_buffer(mi_styler, format):
# gh 47053
with tm.ensure_clean(f"delete_me.{format}") as f:
getattr(mi_styler, f"to_{format}")(f)


def test_deprecation_warning_for_usage_of_aaply_map_index_method_of_styler_object():
# 56717 https://github.com/pandas-dev/pandas/issues/56717
df = DataFrame([[1, 2], [3, 4]], index=["A", "B"])
msg = "Styler.applymap_index has been deprecated. Use Styler.map_index instead."

def color_b(s):
return "background-color:yellow;"

with tm.assert_produces_warning(FutureWarning, match=msg):
df.style.applymap_index(color_b, axis="columns")