From 5a1a9546da74ffe0c7b8293c955103d05e906013 Mon Sep 17 00:00:00 2001 From: Lu Yibo <1478354316@qq.com> Date: Wed, 5 Nov 2025 19:41:45 +0800 Subject: [PATCH 1/3] Add strict mapping to categorical map function --- pandas/tests/arrays/categorical/test_map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arrays/categorical/test_map.py b/pandas/tests/arrays/categorical/test_map.py index 585b207c9b241..cfbdc2cb70eee 100644 --- a/pandas/tests/arrays/categorical/test_map.py +++ b/pandas/tests/arrays/categorical/test_map.py @@ -130,7 +130,7 @@ def test_map_with_dict_or_series(na_action): expected = Categorical(new_values, categories=[3.0, 2, "one"]) tm.assert_categorical_equal(result, expected) - mapper = dict(zip(orig_values[:-1], new_values[:-1])) + mapper = dict(zip(orig_values[:-1], new_values[:-1], strict=True)) result = cat.map(mapper, na_action=na_action) # Order of categories in result can be different tm.assert_categorical_equal(result, expected) From 82fc4cca9e5831d0875346cbd3375ec3557c2968 Mon Sep 17 00:00:00 2001 From: Lu Yibo <1478354316@qq.com> Date: Wed, 5 Nov 2025 19:43:35 +0800 Subject: [PATCH 2/3] Add-strict=True-in-zip() --- pandas/tests/arrays/integer/test_construction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arrays/integer/test_construction.py b/pandas/tests/arrays/integer/test_construction.py index ab52fbec45f79..1e164ff36d133 100644 --- a/pandas/tests/arrays/integer/test_construction.py +++ b/pandas/tests/arrays/integer/test_construction.py @@ -67,7 +67,7 @@ def test_conversions(data_missing): expected = np.array([pd.NA, 1], dtype=object) tm.assert_numpy_array_equal(result, expected) - for r, e in zip(result, expected): + for r, e in zip(result, expected, strict=True): if pd.isnull(r): assert pd.isnull(e) elif is_integer(r): From 2274f020f73b358e801767a20080b1c34c638a3d Mon Sep 17 00:00:00 2001 From: Lu Yibo <1478354316@qq.com> Date: Wed, 5 Nov 2025 19:44:03 +0800 Subject: [PATCH 3/3] Add-strict=True-in-zip() --- pandas/tests/arrays/integer/test_function.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arrays/integer/test_function.py b/pandas/tests/arrays/integer/test_function.py index 892a7a2be7b5c..26ec150c32879 100644 --- a/pandas/tests/arrays/integer/test_function.py +++ b/pandas/tests/arrays/integer/test_function.py @@ -104,7 +104,7 @@ def test_ufunc_binary_output(using_nan_is_na): assert isinstance(result, tuple) assert len(result) == 2 - for x, y in zip(result, expected): + for x, y in zip(result, expected, strict=True): tm.assert_extension_array_equal(x, y)