From 297c98db1209c03da8851f1290acfd366ebee83b Mon Sep 17 00:00:00 2001 From: Ethan Van Hao Date: Thu, 4 Dec 2025 15:12:55 -0800 Subject: [PATCH 1/2] STY: Added zip strict to pandas/test/arithmetic --- pandas/tests/arithmetic/test_interval.py | 2 +- pandas/tests/arithmetic/test_period.py | 4 ++-- pyproject.toml | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pandas/tests/arithmetic/test_interval.py b/pandas/tests/arithmetic/test_interval.py index 0e316cf419cb0..f33f53b201a89 100644 --- a/pandas/tests/arithmetic/test_interval.py +++ b/pandas/tests/arithmetic/test_interval.py @@ -107,7 +107,7 @@ def elementwise_comparison(self, op, interval_array, other): Helper that performs elementwise comparisons between `array` and `other` """ other = other if is_list_like(other) else [other] * len(interval_array) - expected = np.array([op(x, y) for x, y in zip(interval_array, other)]) + expected = np.array([op(x, y) for x, y in zip(interval_array, other, strict=True)]) if isinstance(other, Series): return Series(expected, index=other.index) return expected diff --git a/pandas/tests/arithmetic/test_period.py b/pandas/tests/arithmetic/test_period.py index 7756719654657..54a5625437ace 100644 --- a/pandas/tests/arithmetic/test_period.py +++ b/pandas/tests/arithmetic/test_period.py @@ -962,11 +962,11 @@ def test_pi_add_sub_int_array_freqn_gt1(self): pi = period_range("2016-01-01", periods=10, freq="2D") arr = np.arange(10) result = pi + arr - expected = pd.Index([x + y for x, y in zip(pi, arr)]) + expected = pd.Index([x + y for x, y in zip(pi, arr, strict=True)]) tm.assert_index_equal(result, expected) result = pi - arr - expected = pd.Index([x - y for x, y in zip(pi, arr)]) + expected = pd.Index([x - y for x, y in zip(pi, arr, strict=True)]) tm.assert_index_equal(result, expected) def test_pi_sub_isub_offset(self): diff --git a/pyproject.toml b/pyproject.toml index 12a5633f136cc..cd151ad7bbe27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -463,9 +463,6 @@ exclude = [ "pandas/_testing/asserters.py" = ["B905"] "pandas/_testing/_warnings.py" = ["B905"] "pandas/tests/apply/test_series_apply.py" = ["B905"] -"pandas/tests/arithmetic/test_interval.py" = ["B905"] -"pandas/tests/arithmetic/test_numeric.py" = ["B905"] -"pandas/tests/arithmetic/test_period.py" = ["B905"] "pandas/tests/arrays/categorical/test_map.py" = ["B905"] "pandas/tests/arrays/integer/test_construction.py" = ["B905"] "pandas/tests/arrays/integer/test_function.py" = ["B905"] From 3f954d068f4349f5bca2d9ce4bdb3ee79e36415f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Dec 2025 02:37:54 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pandas/tests/arithmetic/test_interval.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_interval.py b/pandas/tests/arithmetic/test_interval.py index f33f53b201a89..e2353da0dad56 100644 --- a/pandas/tests/arithmetic/test_interval.py +++ b/pandas/tests/arithmetic/test_interval.py @@ -107,7 +107,9 @@ def elementwise_comparison(self, op, interval_array, other): Helper that performs elementwise comparisons between `array` and `other` """ other = other if is_list_like(other) else [other] * len(interval_array) - expected = np.array([op(x, y) for x, y in zip(interval_array, other, strict=True)]) + expected = np.array( + [op(x, y) for x, y in zip(interval_array, other, strict=True)] + ) if isinstance(other, Series): return Series(expected, index=other.index) return expected