From 1dfbcc7efc78f2feafbc1a3163590dcb31810d14 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Date: Thu, 23 Feb 2023 12:07:18 +0000 Subject: [PATCH] Backport PR #51573: CI: Fix failure due to warning --- pandas/tests/indexes/test_common.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandas/tests/indexes/test_common.py b/pandas/tests/indexes/test_common.py index d8e17e48a19b3..23677d77a5273 100644 --- a/pandas/tests/indexes/test_common.py +++ b/pandas/tests/indexes/test_common.py @@ -448,8 +448,15 @@ def test_hasnans_isnans(self, index_flat): @pytest.mark.parametrize("na_position", [None, "middle"]) def test_sort_values_invalid_na_position(index_with_missing, na_position): + dtype = index_with_missing.dtype + warning = ( + PerformanceWarning + if dtype.name == "string" and dtype.storage == "pyarrow" + else None + ) with pytest.raises(ValueError, match=f"invalid na_position: {na_position}"): - index_with_missing.sort_values(na_position=na_position) + with tm.assert_produces_warning(warning): + index_with_missing.sort_values(na_position=na_position) @pytest.mark.parametrize("na_position", ["first", "last"])