Increase coverage to 85% with targeted tests#636
Merged
cvanelteren merged 3 commits intomainfrom Mar 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR focuses on raising overall test coverage (targeting ~85%) by adding targeted unit tests for previously under-covered helper utilities, while also including a few small correctness/robustness fixes in core modules.
Changes:
- Added focused tests for text helpers, scales/transforms, rcsetup validators, projections, plotting input helpers, and several “extra” test modules to improve branch coverage.
- Fixed Mercator inverse latitude transform to match the documented inverse formula.
- Fixed
CutoffTransformdistance initialization for zero-scale segments and hardened colormap translation / rcsetup iterable checks.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ultraplot/tests/test_text_helpers.py | Adds coverage for CurvedText validation, curve setters/getters, ellipsis/upright logic, and draw/update edge cases. |
| ultraplot/tests/test_scale_helpers.py | Adds tests for scale parsing, transform roundtrips, range limiting, and scale factory behaviors. |
| ultraplot/tests/test_rcsetup_helpers.py | Covers rcsetup validators/helpers including YAML/RST helpers and rcparams rename/remove logic. |
| ultraplot/tests/test_proj_helpers.py | Adds tests for custom Cartopy projections’ defaults, warnings, and parameter wiring. |
| ultraplot/tests/test_inputs_helpers.py | Adds coverage for internal input conversion, masking, distribution helpers, and geographic helpers. |
| ultraplot/tests/test_constructor_helpers_extra.py | Adds branch coverage for constructors (Colormap/Cycle/Norm/Locator/Formatter/Scale/Proj). |
| ultraplot/tests/test_config_helpers_extra.py | Adds branch coverage for configuration helpers including style parsing, context modes, and config IO. |
| ultraplot/tests/test_colors_helpers.py | Adds tests for color/clipping helpers, lookup tables, norms, translation, and cache behavior. |
| ultraplot/tests/test_colormap_helpers_extra.py | Adds branch coverage for colormap save/load, conversion methods, and registry/database helpers. |
| ultraplot/tests/test_colorbar_helpers_extra.py | Adds branch coverage for inset colorbar layout, measurement, locator resolution, and reflow behavior. |
| ultraplot/tests/test_axes_base_colorbar_helpers.py | Mirrors inset colorbar helper coverage for axes.base implementation. |
| ultraplot/scale.py | Corrects Mercator inverse transform and fixes zero-scale distance indexing in CutoffTransform. |
| ultraplot/proj.py | Adjusts proj4 parameter initialization format for warped projections. |
| ultraplot/internals/rcsetup.py | Switches iterable detection to np.iterable and avoids errors when YAML table data is empty. |
| ultraplot/colors.py | Hardens _translate_cmap by safely handling missing .name and validating type earlier. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
The last couple of months was slowly chipping away at this. This PR increases the coverage to something that we can proud of sure of when moving forward.
It also fixes some minor bugs that were missed due to lack of coverage -- these are mainly API changes outside ours or small regressions that were missed.