Skip to content

Conversation

@AKHIL-149
Copy link
Contributor

@AKHIL-149AKHIL-149 commented Dec 8, 2025

I added the strict=True parameter to 30 zip() calls across 8 files in the pandas/tests/plotting directory to enforce Ruff rule B905.

Changes made:

  • common.py: 5 zip() calls
  • frame/test_frame_color.py: 11 zip() calls
  • frame/test_frame_groupby.py: 2 zip() calls
  • test_boxplot_method.py: 3 zip() calls
  • test_datetimelike.py: 5 zip() calls
  • test_groupby.py: 1 zip() call
  • test_hist_method.py: 2 zip() calls
  • test_series.py: 1 zip() call

This ensures that all zipped iterables have equal lengths, making the tests more robust and catching potential bugs early during testing.


Checklist:

  • xref STY: Enforce Ruff rule B905, zip-without-explicit-strict #62434
  • Tests added and passed if fixing a bug or adding a new feature - N/A: Style fix, existing tests validate the change
  • All code checks passed
  • Added type annotations to new arguments/methods/functions - N/A: No new code added
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature - N/A: Style fix doesn't require whatsnew entry
  • If I used AI to develop this pull request, I prompted it to follow AGENTS.md - N/A: Manual code changes

I added strict=True parameter to 30 zip() calls across 8 files in the pandas/tests/plotting directory to enforce Ruff rule B905. This ensures that all zipped iterables have equal lengths, making the tests more robust and catching potential bugs early during testing. Files modified: - common.py: 5 zip() calls - frame/test_frame_color.py: 11 zip() calls - frame/test_frame_groupby.py: 2 zip() calls - test_boxplot_method.py: 3 zip() calls - test_datetimelike.py: 5 zip() calls - test_groupby.py: 1 zip() call - test_hist_method.py: 2 zip() calls - test_series.py: 1 zip() call
The comment explicitly states that 'unique and colors length can be differed depending on slice value', so strict=True should not be used in this zip() call as it would raise ValueError when lengths don't match. Fixes test failures in plotting tests.
Fixed test_line_colors_and_styles_subplots and test_kde_colors_and_styles_subplots by removing strict=True. These tests expect default_colors to be longer than axes.
@mroeschkemroeschke added the Code Style Code style, linting, code_checks label Dec 8, 2025
@mroeschkemroeschke added this to the 3.0 milestone Dec 8, 2025
@mroeschkemroeschke merged commit 6fcb267 into pandas-dev:mainDec 8, 2025
45 checks passed
@mroeschke
Copy link
Member

Thanks @AKHIL-149

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code StyleCode style, linting, code_checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@AKHIL-149@mroeschke