-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-49928][PYTHON][TESTS] Refactor plot-related unit tests #48415
Conversation
Irrelevant tests failed, retriggering:
|
def _check_fig_data(self, fig_data, **kwargs): | ||
for key, expected_value in kwargs.items(): | ||
if key in ["x", "y", "labels", "values"]: | ||
converted_values = [v.item() if hasattr(v, "item") else v for v in fig_data[key]] |
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.
To accommodate the change in the representation of scalars in NumPy 2, see NumPy 2.0 release notes.
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.
nit, shall we use isinstance(v, np.generic)
for this purpose?
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.
My concern is that might require the numpy dependency. What do you think?
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.
we can use it with has_numpy
cc @zhengruifeng @HyukjinKwon would you please review thanks! |
We may later port those expected_fig_data dictionaries to a separate JSON file for easier auditing if the number of tests increases |
03e28c2
to
fd31c20
Compare
Merged to master, thank you! |
What changes were proposed in this pull request?
Refactor plot-related unit tests.
Why are the changes needed?
Different plots have different key attributes of the resulting figure to test against. The refactor makes the comparison easier.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Test changes.
Was this patch authored or co-authored using generative AI tooling?
No.