| 670 | ) |
| 671 | @pytest.mark.parametrize("axis", [0, 1]) |
| 672 | def test_apply_subset(self, slice_, axis, df): |
| 673 | def h(x, color="bar"): |
| 674 | return Series(f"color: {color}", index=x.index, name=x.name) |
| 675 | |
| 676 | result = df.style.apply(h, axis=axis, subset=slice_, color="baz")._compute().ctx |
| 677 | expected = { |
| 678 | (r, c): [("color", "baz")] |
| 679 | for r, row in enumerate(df.index) |
| 680 | for c, col in enumerate(df.columns) |
| 681 | if row in df.loc[slice_].index and col in df.loc[slice_].columns |
| 682 | } |
| 683 | assert result == expected |
| 684 | |
| 685 | @pytest.mark.parametrize( |
| 686 | "slice_", |