Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Group shape/dtype validation logic in image_resample. #25152

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

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Feb 4, 2023

Move it all to a single place rather than having some of it interspersed with the dtype dispatch later.

Also reorder the dtype dispatch to be consistent in the 2D and 3D cases, and remove _array from many local variable names.

PR Summary

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Ideally, this would get some pytest.raises(ValueError, "match") for the updated error strings that are missing coverage.

@anntzer
Copy link
Contributor Author

anntzer commented Feb 7, 2023

Sure, added tests.

&params.interpolation, &convert_bool, &params.resample,
&params.alpha, &convert_bool, &params.norm, &params.radius)) {
return NULL;
}

if (params.interpolation < 0 || params.interpolation >= _n_interpolation) {
PyErr_Format(PyExc_ValueError, "invalid interpolation value %d",
PyErr_Format(PyExc_ValueError, "INvalid interpolation value %d",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PyErr_Format(PyExc_ValueError, "INvalid interpolation value %d",
PyErr_Format(PyExc_ValueError, "Invalid interpolation value %d",

(or was this on purpose?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, fixed.

Copy link
Member

@oscargus oscargus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor capitalization thingy, but otherwise looks good! Anyone can merge after fixing that.

Move it all to a single place rather than having some of it interspersed
with the dtype dispatch later.

Also reorder the dtype dispatch to be consistent in the 2D and 3D cases,
and remove _array from many local variable names.
@ksunden ksunden added this to the v3.8.0 milestone Feb 8, 2023
@ksunden ksunden merged commit 79570ab into matplotlib:main Feb 8, 2023
@anntzer anntzer deleted the ir branch February 8, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants