Skip to content

Commit

Permalink
TST: Additions/updates to tests (#56822)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jomorodi committed Jan 11, 2024
1 parent d7ce2ce commit fa5e835
Showing 1 changed file with 12 additions and 0 deletions.
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")

0 comments on commit fa5e835

Please sign in to comment.