Skip to content

Commit deb63b5

Browse files
authored
STY: add strict arg to zip() in files (#63450)
1 parent c25701f commit deb63b5

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

pandas/tests/strings/test_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
("empty", []),
2222
("mixed-integer", ["a", np.nan, 2]),
2323
]
24-
ids, _ = zip(*_any_allowed_skipna_inferred_dtype) # use inferred type as id
24+
ids, _ = zip(
25+
*_any_allowed_skipna_inferred_dtype, strict=True
26+
) # use inferred type as id
2527

2628

2729
@pytest.fixture(params=_any_allowed_skipna_inferred_dtype, ids=ids)

pandas/tests/strings/test_strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ def test_cat_on_bytes_raises():
767767

768768
def test_str_accessor_in_apply_func():
769769
# https://github.com/pandas-dev/pandas/issues/38979
770-
df = DataFrame(zip("abc", "def"))
770+
df = DataFrame(zip("abc", "def", strict=True))
771771
expected = Series(["A/D", "B/E", "C/F"])
772772
result = df.apply(lambda f: "/".join(f.str.upper()), axis=1)
773773
tm.assert_series_equal(result, expected)

pandas/tests/test_algos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ def test_duplicated_with_nas(self):
14821482

14831483
keys = np.empty(8, dtype=object)
14841484
for i, t in enumerate(
1485-
zip([0, 0, np.nan, np.nan] * 2, [0, np.nan, 0, np.nan] * 2)
1485+
zip([0, 0, np.nan, np.nan] * 2, [0, np.nan, 0, np.nan] * 2, strict=True)
14861486
):
14871487
keys[i] = t
14881488

pandas/tests/test_sorting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def test_decons(codes_list, shape):
358358
group_index = get_group_index(codes_list, shape, sort=True, xnull=True)
359359
codes_list2 = _decons_group_index(group_index, shape)
360360

361-
for a, b in zip(codes_list, codes_list2):
361+
for a, b in zip(codes_list, codes_list2, strict=True):
362362
tm.assert_numpy_array_equal(a, b)
363363

364364

pandas/tests/util/test_validate_kwargs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_not_all_none(i, _fname):
3737
kwarg_keys = ("foo", "bar", "baz")
3838
kwarg_vals = (2, "s", None)
3939

40-
kwargs = dict(zip(kwarg_keys[:i], kwarg_vals[:i]))
40+
kwargs = dict(zip(kwarg_keys[:i], kwarg_vals[:i], strict=True))
4141

4242
with pytest.raises(ValueError, match=msg):
4343
validate_kwargs(_fname, kwargs, compat_args)

0 commit comments

Comments
 (0)