Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
QuLogic merged 1 commit intomatplotlib:mainfromstory645:test_table
Jan 24, 2024

Conversation

story645
Copy link
Member

Tests that table doesn't participate in the unit pipeline by testing that it doesn't convert datetimes.

@story645
Copy link
MemberAuthor

story645 commentedOct 2, 2023
edited
Loading

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)

fig_test.subplots().table(data)
fig_ref.subplots().table([["Hello", "Hello"], ["Hello", "Hello"]])

assert not fake_convertor.convert.called
Copy link
Member

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.

Copy link
MemberAuthor

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

@jklymak
Copy link
Member

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
Copy link
MemberAuthor

story645 commentedOct 15, 2023
edited
Loading

It is hard to understand how anyone could ever screw that up to justify the extra complexity and compute time.

It's a unit test that takesalmost no time .9 second at most to run, and the complexity is the most straightforward unit + conversion you can write.

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.

It would be like testing that set_xlabel or the string argument of ax.text doesn't participate in the units pipeline.

ax.text takes numbers for the positions so arguably it should (and maybe does?) participate in the units pipeline.

@dstansby
Copy link
Member

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?

@story645
Copy link
MemberAuthor

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.

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
@QuLogicQuLogic merged commitc5b9343 intomatplotlib:mainJan 24, 2024
@story645story645 deleted the test_table branchJanuary 24, 2024 23:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@QuLogicQuLogicQuLogic left review comments

@rcomerrcomerrcomer left review comments

@ksundenksundenksunden approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.9.0
Development

Successfully merging this pull request may close these issues.

7 participants
@story645@jklymak@dstansby@tacaswell@QuLogic@ksunden@rcomer

[8]ページ先頭

©2009-2025 Movatter.jp