You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've gone down a bit of a rabbit hole with #17930, and I've noticed that our testing for units is rather sparse. lib/matplotlib/tests/test_units.py only really checks plot, scatter, axhline, axvline, and bar, but we have many more artists that are peppered with unit conversion handling.
Proposed Solution
We need to expand test_units.py to cover almost all artist-creating functions that need to handle units. Now we have check_figures_equal, so we can do something about it that doesn't explore the number of test images, with a plot reference figure with non-unit functions, and a plot test figure with unitized functions.
I don't really understand what the expected unit conversion interface is, so I don't know how exactly to write the tests. I tried to do one for errorbar using Quantity, but it didn't work and I don't know if that's because Quantity does not implement enough for the unit registry, or whether errorbar doesn't correctly handle units.
We need to expand test_units.py to cover almost all artist-creating functions that need to handle units.
I'd rather put that next to the respective Artist tests. You won't easily notice that an Artist is missing among 15 or so artist unit tests. But you might see that there is no tests for units among the tests for a specific artist.
Sure, that might work too. I went with test_units.py because it already has Quantity (which may or may not be fully implemented), though we also have jpl_units that could be used. Also, test_axes.py is already kind of huge.
Quantity was created for me to test what I've needed to fix to work with pint. It's entirely possible it could use some more things to work across all the possible uses.
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
timhoffm commentedon Aug 18, 2020
I'd rather put that next to the respective Artist tests. You won't easily notice that an Artist is missing among 15 or so artist unit tests. But you might see that there is no tests for units among the tests for a specific artist.
QuLogic commentedon Aug 18, 2020
Sure, that might work too. I went with
test_units.pybecause it already hasQuantity(which may or may not be fully implemented), though we also havejpl_unitsthat could be used. Also,test_axes.pyis already kind of huge.dopplershift commentedon Aug 18, 2020
Quantitywas created for me to test what I've needed to fix to work with pint. It's entirely possible it could use some more things to work across all the possible uses.github-actions commentedon Aug 16, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
QuLogic commentedon Aug 17, 2023
Probably something for @ksunden to look into, though this is a bit of a broad issue.