Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
MNT: test that table doesn't try to convert unitized data#26953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
story645 commentedOct 2, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Wrote a mock convertor and checked it wasn't called. Wondering if it'd be useful to have a unit registry context manager, but that's very very outside the scope of this PR. (ETA: also a dummy units fixture) |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
lib/matplotlib/tests/test_table.py Outdated
fig_test.subplots().table(data) | ||
fig_ref.subplots().table([["Hello", "Hello"], ["Hello", "Hello"]]) | ||
assert not fake_convertor.convert.called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Do we need to trigger a draw as well? That won't have happened at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
yeah converts seem to be called in .draw methods
I'm not following the purpose of this PR. It would be like testing that set_xlabel or the string argument of ax.text doesn't participate in the units pipeline. It is hard to understand how anyone could ever screw that up to justify the extra complexity and compute time. |
story645 commentedOct 15, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It's a unit test that takes Yes, it's testing that table does what we expect it to so that it someone refractors table (which is a thing lots of folks have wanted to do) we have a test that it still behaves as expected. Also depending on where units go, it may make sense for table to participate in units... I'm all for dumb tests that verify things do exactly what we say they do given the amount of side quests involved in making almost any medium sized change.
|
Uh oh!
There was an error while loading.Please reload this page.
I'm also slightly confused as to what this is testing? Are you trying to check that e.g., a datetime in a table doesn't get converted by the units machinery to a floating point number before being converted to a string to go in the table? |
Basically. Since table is doing an internal conversion using string, just double checking that that's what it's doing. This is a "this is our underlying assumption" test. |
Uh oh!
There was an error while loading.Please reload this page.
36c4beb
tobb6c7e9
CompareUh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
Tests that table doesn't participate in the unit pipeline by testing that it doesn't convert datetimes.