Skip to content

Strictly increasing check with test coverage for streamplot grid#18947

Merged
tacaswell merged 2 commits intomatplotlib:masterfrom
aitikgupta:streamplot-grid
Nov 21, 2020
Merged

Strictly increasing check with test coverage for streamplot grid#18947
tacaswell merged 2 commits intomatplotlib:masterfrom
aitikgupta:streamplot-grid

Conversation

@aitikgupta
Copy link
Contributor

PR Summary

This PR fixes #18898, adds check for strictly increasing x and y in matplotlib.streamplot.Grid, and adds test coverage for it.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

y = np.array([[10, 10], [20, 20]])

msg = "The rows of 'x' must be equal"
with pytest.raises(ValueError, match=msg):
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather inline the message in the function. Having a separate variable is an unnecessary indirection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something like I just pushed?

x = np.array([0, 10])
y = np.array([[[0, 10]]])

with pytest.raises(ValueError, match="'y' can have at maximum"
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
with pytest.raises(ValueError, match="'y' can have at maximum"
with pytest.raises(ValueError, match="'y' can have at maximum "

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍🏼

@tacaswell tacaswell added this to the v3.4.0 milestone Nov 21, 2020
@tacaswell tacaswell merged commit b0bc62e into matplotlib:master Nov 21, 2020
@tacaswell
Copy link
Member

Thanks @aitikgupta ! Congratulations on your first Matplotlib PR 🎉 , hopefully we will hear from you again!

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.

wrong bounds checking in streamplot start_points

3 participants