From ab69e6c72ad0395ba4b82f22d60d13fab0d7f73d Mon Sep 17 00:00:00 2001 From: Lonercode Date: Sun, 21 Dec 2025 13:01:27 +0100 Subject: [PATCH 1/2] STY: add strict arg to zip() in files --- pandas/tests/strings/test_api.py | 2 +- pandas/tests/strings/test_strings.py | 2 +- pandas/tests/test_algos.py | 2 +- pandas/tests/test_sorting.py | 2 +- pandas/tests/util/test_validate_kwargs.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/tests/strings/test_api.py b/pandas/tests/strings/test_api.py index 6b9df072019eb..470ece15fa536 100644 --- a/pandas/tests/strings/test_api.py +++ b/pandas/tests/strings/test_api.py @@ -21,7 +21,7 @@ ("empty", []), ("mixed-integer", ["a", np.nan, 2]), ] -ids, _ = zip(*_any_allowed_skipna_inferred_dtype) # use inferred type as id +ids, _ = zip(*_any_allowed_skipna_inferred_dtype, strict=True) # use inferred type as id @pytest.fixture(params=_any_allowed_skipna_inferred_dtype, ids=ids) diff --git a/pandas/tests/strings/test_strings.py b/pandas/tests/strings/test_strings.py index 5873800794d49..83b332f6e720e 100644 --- a/pandas/tests/strings/test_strings.py +++ b/pandas/tests/strings/test_strings.py @@ -767,7 +767,7 @@ def test_cat_on_bytes_raises(): def test_str_accessor_in_apply_func(): # https://github.com/pandas-dev/pandas/issues/38979 - df = DataFrame(zip("abc", "def")) + df = DataFrame(zip("abc", "def", strict=True)) expected = Series(["A/D", "B/E", "C/F"]) result = df.apply(lambda f: "/".join(f.str.upper()), axis=1) tm.assert_series_equal(result, expected) diff --git a/pandas/tests/test_algos.py b/pandas/tests/test_algos.py index 588cd08a6b618..ee34dff844695 100644 --- a/pandas/tests/test_algos.py +++ b/pandas/tests/test_algos.py @@ -1482,7 +1482,7 @@ def test_duplicated_with_nas(self): keys = np.empty(8, dtype=object) for i, t in enumerate( - zip([0, 0, np.nan, np.nan] * 2, [0, np.nan, 0, np.nan] * 2) + zip([0, 0, np.nan, np.nan] * 2, [0, np.nan, 0, np.nan] * 2, strict=True) ): keys[i] = t diff --git a/pandas/tests/test_sorting.py b/pandas/tests/test_sorting.py index 3ce1094c1d629..8c39d5c506516 100644 --- a/pandas/tests/test_sorting.py +++ b/pandas/tests/test_sorting.py @@ -358,7 +358,7 @@ def test_decons(codes_list, shape): group_index = get_group_index(codes_list, shape, sort=True, xnull=True) codes_list2 = _decons_group_index(group_index, shape) - for a, b in zip(codes_list, codes_list2): + for a, b in zip(codes_list, codes_list2, strict=True): tm.assert_numpy_array_equal(a, b) diff --git a/pandas/tests/util/test_validate_kwargs.py b/pandas/tests/util/test_validate_kwargs.py index dba447e30cf57..85d93638f788f 100644 --- a/pandas/tests/util/test_validate_kwargs.py +++ b/pandas/tests/util/test_validate_kwargs.py @@ -37,7 +37,7 @@ def test_not_all_none(i, _fname): kwarg_keys = ("foo", "bar", "baz") kwarg_vals = (2, "s", None) - kwargs = dict(zip(kwarg_keys[:i], kwarg_vals[:i])) + kwargs = dict(zip(kwarg_keys[:i], kwarg_vals[:i], strict=True)) with pytest.raises(ValueError, match=msg): validate_kwargs(_fname, kwargs, compat_args) From cee60e1a3affebe09043f8954a6f236a2d8729e4 Mon Sep 17 00:00:00 2001 From: Lonercode Date: Sun, 21 Dec 2025 13:23:35 +0100 Subject: [PATCH 2/2] STY: minor pre-commit fix --- pandas/tests/strings/test_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/tests/strings/test_api.py b/pandas/tests/strings/test_api.py index 470ece15fa536..cbb663cdca4ad 100644 --- a/pandas/tests/strings/test_api.py +++ b/pandas/tests/strings/test_api.py @@ -21,7 +21,9 @@ ("empty", []), ("mixed-integer", ["a", np.nan, 2]), ] -ids, _ = zip(*_any_allowed_skipna_inferred_dtype, strict=True) # use inferred type as id +ids, _ = zip( + *_any_allowed_skipna_inferred_dtype, strict=True +) # use inferred type as id @pytest.fixture(params=_any_allowed_skipna_inferred_dtype, ids=ids)