From 895b78bc4876a82c800967d81e546c36a7e8b706 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Thu, 23 Feb 2023 00:05:17 +0000 Subject: [PATCH 1/2] CI: Fix failure due to warning --- pandas/tests/indexes/test_common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandas/tests/indexes/test_common.py b/pandas/tests/indexes/test_common.py index d8e17e48a19b3..d8128fea4cc7e 100644 --- a/pandas/tests/indexes/test_common.py +++ b/pandas/tests/indexes/test_common.py @@ -448,8 +448,13 @@ 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 == "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"]) From 22dafb46e42498a7a05eef51ce8325def88ad068 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Thu, 23 Feb 2023 10:14:25 +0000 Subject: [PATCH 2/2] Fix --- pandas/tests/indexes/test_common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/tests/indexes/test_common.py b/pandas/tests/indexes/test_common.py index d8128fea4cc7e..23677d77a5273 100644 --- a/pandas/tests/indexes/test_common.py +++ b/pandas/tests/indexes/test_common.py @@ -450,7 +450,9 @@ def test_hasnans_isnans(self, index_flat): def test_sort_values_invalid_na_position(index_with_missing, na_position): dtype = index_with_missing.dtype warning = ( - PerformanceWarning if dtype == "string" and dtype.storage == "pyarrow" else None + PerformanceWarning + if dtype.name == "string" and dtype.storage == "pyarrow" + else None ) with pytest.raises(ValueError, match=f"invalid na_position: {na_position}"): with tm.assert_produces_warning(warning):