Skip to content

Fix #639: unskip and harden the vcenter colormap test - #823

Draft
jessiedoe03-cpu wants to merge 2 commits into
Ultraplot:mainfrom
jessiedoe03-cpu:fix/issue-639-turn-a-skipped-vcenter-2d-plot-check-int
Draft

Fix #639: unskip and harden the vcenter colormap test#823
jessiedoe03-cpu wants to merge 2 commits into
Ultraplot:mainfrom
jessiedoe03-cpu:fix/issue-639-turn-a-skipped-vcenter-2d-plot-check-int

Conversation

@jessiedoe03-cpu

Copy link
Copy Markdown

Fixes #639.

test_colormap_vcenter was skipped with "not sure what this does". The test
body already called pcolor(data, vcenter=...), so the intent was there - but
vcenter was never plumbed through PlotAxes._parse_cmap. It fell through to
the artist and raised:

AttributeError: PolyQuadMesh.set() got an unexpected keyword argument 'vcenter'

so the test could not simply be unskipped; the parameter had to work first.

What this does

  • Unskips test_colormap_vcenter and replaces the image comparison with
    deterministic assertions: the centre maps to 0.5 in both discrete and
    continuous mode, and vcenter= matches norm_kw={'vcenter': ...}.
  • Accepts vcenter in _parse_cmap alongside vmin/vmax, forwarding it into
    norm_kw, and extends the existing "don't combine these with an explicit
    Normalize instance" guard to cover it.

One decision worth your call

When vcenter is given and no norm is specified, this selects the diverging
normalizer. That seemed the only sensible reading, and it is what the original
skipped test implied - but it is a behaviour choice rather than pure plumbing,
so say if you would rather it were explicit or named differently.

Testing

  • test_colormap_vcenter: 1 passed, 1 warning in 1.66s
  • Whole file: 1 failed, 32 passed, 1 skipped, 97 warnings in 11.66s
  • With ultraplot/axes/plot.py reverted and the new test kept: 1 failed, 1 warning in 1.50s -
    so the test genuinely covers the change rather than passing regardless.

Any remaining failures in that file are pre-existing _tkinter.TclError issues
in my environment (no display); they fail on the base commit too, and which one
trips varies with run order. Please let CI have the final word.


This patch was written with AI assistance (the code by Google Antigravity, the
review and this pull request prepared with Claude Code) and was reviewed and
tested before submitting by @jessiedoe03-cpu. Happy to revise or close it if it is not the
direction you want.

🤖 Generated with Claude Code

`test_colormap_vcenter` was skipped with "not sure what this does". The
test body already called `pcolor(data, vcenter=...)`, so the intent was
there, but `vcenter` was never plumbed through `PlotAxes._parse_cmap` -
it fell through to the artist and raised:

    AttributeError: PolyQuadMesh.set() got an unexpected keyword
    argument 'vcenter'

So the test is unskipped and given deterministic assertions, and
`vcenter` is accepted alongside `vmin`/`vmax`: it is forwarded into
`norm_kw`, and selects the diverging normalizer when no norm is given.
The guard against combining these with an explicit `Normalize` instance
now covers `vcenter` too.

The test asserts the centre maps to 0.5 in both discrete and continuous
mode, and that passing `vcenter=` directly matches `norm_kw={'vcenter':}`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/axes/plot.py 83.33% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@cvanelteren
cvanelteren marked this pull request as draft September 8, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Turn a skipped vcenter 2D plot check into a deterministic regression test

2 participants