diff --git a/pandas/tests/copy_view/test_indexing.py b/pandas/tests/copy_view/test_indexing.py index 422436d376f69..72cb410c9068d 100644 --- a/pandas/tests/copy_view/test_indexing.py +++ b/pandas/tests/copy_view/test_indexing.py @@ -941,15 +941,14 @@ def test_column_as_series(backend, using_copy_on_write, warn_copy_on_write): if using_copy_on_write: s[0] = 0 + elif warn_copy_on_write: + with tm.assert_cow_warning(): + s[0] = 0 else: - if warn_copy_on_write: - with tm.assert_cow_warning(): + warn = SettingWithCopyWarning if dtype_backend == "numpy" else None + with pd.option_context("chained_assignment", "warn"): + with tm.assert_produces_warning(warn): s[0] = 0 - else: - warn = SettingWithCopyWarning if dtype_backend == "numpy" else None - with pd.option_context("chained_assignment", "warn"): - with tm.assert_produces_warning(warn): - s[0] = 0 expected = Series([0, 2, 3], name="a") tm.assert_series_equal(s, expected) diff --git a/pandas/tests/window/test_rolling.py b/pandas/tests/window/test_rolling.py index 2a3a0a54d0767..0ca6bf0de94dd 100644 --- a/pandas/tests/window/test_rolling.py +++ b/pandas/tests/window/test_rolling.py @@ -1693,12 +1693,11 @@ def test_rolling_quantile_interpolation_options(quantile, interpolation, data): if np.isnan(q1): assert np.isnan(q2) + elif not IS64: + # Less precision on 32-bit + assert np.allclose([q1], [q2], rtol=1e-07, atol=0) else: - if not IS64: - # Less precision on 32-bit - assert np.allclose([q1], [q2], rtol=1e-07, atol=0) - else: - assert q1 == q2 + assert q1 == q2 def test_invalid_quantile_value(): diff --git a/pandas/util/_validators.py b/pandas/util/_validators.py index cb0b4d549f49e..4e542d1b7f04a 100644 --- a/pandas/util/_validators.py +++ b/pandas/util/_validators.py @@ -335,9 +335,8 @@ def validate_percentile(q: float | Iterable[float]) -> np.ndarray: if q_arr.ndim == 0: if not 0 <= q_arr <= 1: raise ValueError(msg) - else: - if not all(0 <= qs <= 1 for qs in q_arr): - raise ValueError(msg) + elif not all(0 <= qs <= 1 for qs in q_arr): + raise ValueError(msg) return q_arr diff --git a/pyproject.toml b/pyproject.toml index ebdf9deb034b5..4f11cfb17edd1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -337,8 +337,6 @@ ignore = [ "PLR2004", # comparison-with-itself "PLR0124", - # Consider `elif` instead of `else` then `if` to remove indentation level - "PLR5501", # collection-literal-concatenation "RUF005", # pairwise-over-zipped (>=PY310 only)