ECharts adapter correctness and honest visualization tests (#509, #512) - #526
Merged
Merged
Conversation
…e leak The four TestPlotlyAnnotationRendering tests asserted only that the figure dict has a "data" key, which is true of every Plotly figure, so they passed whether or not the annotation rendered at all. They now pin layout.shapes (count, x0/x1 vs y0/y1, axis refs, fillcolor) and layout.annotations, and the skipped-band test compares against a band-free baseline. test_set_theme_changes_default restored the package DEFAULT_THEME instead of the value in effect before the test, mutating plotly.io.templates.default for every later test in the worker; it now restores the captured prior value via monkeypatch. The background-colour test's docstring claimed each theme has a distinct background while asserting two identical white values; it now pins all four values without the distinctness claim. Closes #512. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019C3XXbJkuSYH9fMryLqNcU
…ed members Annotations now attach to a series of the panel they belong to: the single-panel and multi-panel paths share one _attach_annotations helper, and a panel with annotations but no layers gets an empty carrier series bound to its own axes instead of painting the previous panel (the old code attached to the cumulative all_series[-1]). Missing data fields raise KeyError instead of silently plotting 0, in _paired_data and _wireframe_series, matching the Plotly adapter's direct row[field] lookups. A ragged z_matrix in _heatmap_series raises ValueError naming the expected shape instead of filling missing cells with 0. Per-point style lists (colors, error_y) whose length differs from the data raise ValueError naming the layer and the style key; the three previously non-strict zips are now strict=True, matching visualization/tools.py. MarkType.area and AnnotationType.label are declared in types.py but were implemented in neither adapter; both adapters now raise NotImplementedError for them instead of silently falling back to a scatter trace or dropping the annotation. Closes #509. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019C3XXbJkuSYH9fMryLqNcU
Version assumes the queued PRs carrying 1.72.x/1.73.0 merge first. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019C3XXbJkuSYH9fMryLqNcU
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
The typecheck gate is red on main itself: the unpinned mcp extra now resolves to mcp 2.x, where FastMCP was renamed MCPServer, so mypy fails on mcp_server.py on every branch. This ports the migrated server and the mcp>=2.0 floor verbatim from #528; the diff no-ops once #528 merges. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019C3XXbJkuSYH9fMryLqNcU
Owner
Author
|
Two notes on the red checks:
Generated by Claude Code |
This was referenced Aug 29, 2026
…e-library-issues-hr7xxk-viz # Conflicts: # CHANGELOG.md # CITATION.cff # pyproject.toml
…e-library-issues-hr7xxk-viz # Conflicts: # CHANGELOG.md # CITATION.cff # pyproject.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fixes #509 and Fixes #512.
TestPlotlyAnnotationRenderingtests asserted only"data" in result, which every Plotly figure dict satisfies. They now assert on the renderedlayout["shapes"](count,x0/x1vsy0/y1,xref/yrefto pin the axis,fillcolor) andlayout["annotations"], in the style ofTestPlotlyContourStyling; the incomplete-band test compares against a band-free baseline so the skip is actually pinned.test_set_theme_changes_defaultnow restores theplotly.io.templates.defaultvalue captured before the test (viamonkeypatch) instead of forcing the package default, so the theme no longer leaks into later tests in the same xdist worker. The background-colour test no longer claims all four themes are distinct; it pins all four values (pi_tufteandpi_journaldeliberately share white)._attach_annotationshelper (attaching to the panel's first series), and a panel with annotations but no layers gets an empty, silent carrier series bound to its own axes instead of painting the previous panel viaall_series[-1]._paired_dataand_wireframe_seriesuse directrow[field]lookups, so a missing or typo'd field raisesKeyError, matching the Plotly adapter, instead of silently plotting 0.z_matrixin_heatmap_seriesraisesValueErrornaming the layer and expected(len(y_grid), len(x_grid))shape instead of filling cells with 0.strict=True, preceded by an explicit length check that raises a clearValueErrornaming the layer and style key. Decision:types.pydocumentsstyleas "extra visual properties" with nothing implying a shorter colour list should cycle, and every in-repo producer (experiments/visualization/plots/significance.py) buildscolors/error_yone-per-point from the same data, so a length mismatch indicates a bug and raising (not cycling) is the behaviour that matches the spec andvisualization/tools.py.MarkType.areaandAnnotationType.labelare declared intypes.pybut implemented in neither adapter; both adapters now raiseNotImplementedErrorwith a message naming the member, instead of Plotly silently falling back to scatter and ECharts dropping the label.MarkType.areaorAnnotationType.label, and all producers ofcolors/error_y/grid-style layers (src/process_improve/visualization/charts/,src/process_improve/experiments/visualization/plots/,experiments/_tools/visualize_doe.py) build matched-length lists and rectangular matrices, so no caller adjustments were needed;tests/test_experiments_tools.pyconfirms.pyproject.tomlandCITATION.cff(date-released2026-08-29), new## [1.73.1] - 2026-08-29changelog section with footer links. The version is set assuming the earlier queued PRs (carrying 1.72.x/1.73.0) merge first; if they land differently this needs only a trivial rebase.Test plan
uv run pytest tests/test_visualization_spec.py tests/test_themes.py tests/test_echarts_multi_panel.py tests/test_visualization.py tests/test_viz_boxplot.py --no-cov -q: 240 passeduv run pytest tests/test_experiments_tools.py --no-cov -q: 39 passed (DOE callers of the adapters unaffected)KeyError; ragged heatmap raisesValueError; shortcolors/error_yraiseValueError;MarkType.area/AnnotationType.labelraiseNotImplementedErrorin both adaptersuv run ruff check .anduv run ruff format --check .both passuv run mypy src/process_improve: only the pre-existingmcp_server.py:39FastMCP errorChecklist
pyproject.toml(PATCH for fixes/docs/config, MINOR for new features)ruff check .passesCHANGELOG.mdupdatedGenerated by Claude Code