From 63c949815fa3e8aebbfb48f9393e7468931708c8 Mon Sep 17 00:00:00 2001 From: wdyy20041223 <2795352227@qq,com> Date: Wed, 29 Oct 2025 17:29:14 +0800 Subject: [PATCH 1/2] STY: Add strict=True to zip() calls in pandas\tests\arrays --- pandas/tests/arrays/sparse/test_constructors.py | 2 +- pandas/tests/arrays/test_datetimes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/arrays/sparse/test_constructors.py b/pandas/tests/arrays/sparse/test_constructors.py index 0bf3ab77e9eed..795b0cabc32fd 100644 --- a/pandas/tests/arrays/sparse/test_constructors.py +++ b/pandas/tests/arrays/sparse/test_constructors.py @@ -77,7 +77,7 @@ def test_constructor_object_dtype_bool_fill(self): assert arr.dtype == SparseDtype(object, False) assert arr.fill_value is False arr_expected = np.array(data, dtype=object) - it = (type(x) == type(y) and x == y for x, y in zip(arr, arr_expected)) + it = (type(x) == type(y) and x == y for x, y in zip(arr, arr_expected, strict=True)) assert np.fromiter(it, dtype=np.bool_).all() @pytest.mark.parametrize("dtype", [SparseDtype(int, 0), int]) diff --git a/pandas/tests/arrays/test_datetimes.py b/pandas/tests/arrays/test_datetimes.py index 199e3572732a0..5a7cad77a9de0 100644 --- a/pandas/tests/arrays/test_datetimes.py +++ b/pandas/tests/arrays/test_datetimes.py @@ -144,7 +144,7 @@ def test_iter(self, dta): def test_astype_object(self, dta): result = dta.astype(object) assert all(x._creso == dta._creso for x in result) - assert all(x == y for x, y in zip(result, dta)) + assert all(x == y for x, y in zip(result, dta, strict=True)) def test_to_pydatetime(self, dta_dti): dta, dti = dta_dti From 9339b3f9d14c5a7f6ea1922e86a450e963313d10 Mon Sep 17 00:00:00 2001 From: wdyy20041223 <2795352227@qq,com> Date: Wed, 29 Oct 2025 17:36:39 +0800 Subject: [PATCH 2/2] STY: Add strict=True to zip() calls in pandas\tests\arrays --- pandas/tests/arrays/sparse/test_constructors.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/tests/arrays/sparse/test_constructors.py b/pandas/tests/arrays/sparse/test_constructors.py index 795b0cabc32fd..c6099ea48cccb 100644 --- a/pandas/tests/arrays/sparse/test_constructors.py +++ b/pandas/tests/arrays/sparse/test_constructors.py @@ -77,7 +77,10 @@ def test_constructor_object_dtype_bool_fill(self): assert arr.dtype == SparseDtype(object, False) assert arr.fill_value is False arr_expected = np.array(data, dtype=object) - it = (type(x) == type(y) and x == y for x, y in zip(arr, arr_expected, strict=True)) + it = ( + type(x) == type(y) and x == y + for x, y in zip(arr, arr_expected, strict=True) + ) assert np.fromiter(it, dtype=np.bool_).all() @pytest.mark.parametrize("dtype", [SparseDtype(int, 0), int])