Skip to content

Commit a481e23

Browse files
committed
STY: Add strict=True to zip() calls in pandas/_testing
- Add explicit strict=True to zip() calls in pandas/_testing/asserters.py (2 calls) - Add explicit strict=True to zip() calls in pandas/_testing/_warnings.py (1 call) - Satisfies Ruff rule B905 (zip-without-explicit-strict) Towards #62434
1 parent 56a85b2 commit a481e23

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pandas/_testing/_warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class for all warnings. To raise multiple types of exceptions,
110110
if isinstance(match, tuple)
111111
else (match,) * len(expected_warning)
112112
)
113-
for warning_type, warning_match in zip(expected_warning, match):
113+
for warning_type, warning_match in zip(expected_warning, match, strict=True):
114114
_assert_caught_expected_warnings(
115115
caught_warnings=w,
116116
expected_warning=warning_type,

pandas/_testing/asserters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ def _raise(left, right, err_msg) -> NoReturn:
675675
)
676676

677677
diff = 0
678-
for left_arr, right_arr in zip(left, right):
678+
for left_arr, right_arr in zip(left, right, strict=True):
679679
# count up differences
680680
if not array_equivalent(left_arr, right_arr, strict_nan=strict_nan):
681681
diff += 1
@@ -1447,7 +1447,7 @@ def assert_copy(iter1, iter2, **eql_kwargs) -> None:
14471447
the same object. (Does not check that items
14481448
in sequences are also not the same object)
14491449
"""
1450-
for elem1, elem2 in zip(iter1, iter2):
1450+
for elem1, elem2 in zip(iter1, iter2, strict=True):
14511451
assert_almost_equal(elem1, elem2, **eql_kwargs)
14521452
msg = (
14531453
f"Expected object {type(elem1)!r} and object {type(elem2)!r} to be "

0 commit comments

Comments
 (0)