STY: Add strict=True in zip() in \_testing and \asv_bench #62793
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Enforce Python 3.10+ best practices by adding
strict=Trueto allzip()calls in key files. This ensures input iterables are of equal length, raisingValueErrorotherwise and preventing silent truncation.Files Changed
asv_bench/benchmarks/ctors.pyasv_bench/benchmarks/series_methods.pypandas/_testing/_warnings.pypandas/_testing/asserters.pyChanges
zip()calls updated tozip(..., strict=True):dict(zip(range(len(arr)), arr))→dict(zip(range(len(arr)), arr, strict=True))dict(zip(self.idx, range(len(self.idx))))→dict(zip(self.idx, range(len(self.idx)), strict=True))dict(zip(self.to_replace_list, self.values_list))→dict(zip(self.to_replace_list, self.values_list, strict=True))for warning_type, warning_match in zip(expected_warning, match):→for warning_type, warning_match in zip(expected_warning, match, strict=True):for left_arr, right_arr in zip(left, right):→for left_arr, right_arr in zip(left, right, strict=True):for elem1, elem2 in zip(iter1, iter2):→for elem1, elem2 in zip(iter1, iter2, strict=True):