| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import pytest | ||
| import numpy as np | ||
| from matplotlib import pyplot as plt | ||
|
|
||
|
|
||
| @pytest.mark.backend('TkAgg', skip_on_importerror=True) | ||
| def test_blit(): | ||
| from matplotlib.backends import _tkagg | ||
| def evil_blit(photoimage, aggimage, offsets, bboxptr): | ||
| data = np.asarray(aggimage) | ||
| height, width = data.shape[:2] | ||
| dataptr = (height, width, data.ctypes.data) | ||
| _tkagg.blit( | ||
| photoimage.tk.interpaddr(), str(photoimage), dataptr, offsets, | ||
| bboxptr) | ||
|
|
||
| fig, ax = plt.subplots() | ||
| for bad_boxes in ((-1, 2, 0, 2), | ||
| (2, 0, 0, 2), | ||
| (1, 6, 0, 2), | ||
| (0, 2, -1, 2), | ||
| (0, 2, 2, 0), | ||
| (0, 2, 1, 6)): | ||
| with pytest.raises(ValueError): | ||
| evil_blit(fig.canvas._tkphoto, | ||
| np.ones((4, 4, 4)), | ||
| (0, 1, 2, 3), | ||
| bad_boxes) |
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI find it easier this way "y1 is smaller than 0 or larger than y2". 0 > y1 sort of ties a knot in my brain. 😄
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThat is fair, but having all of the > go the same way is also helpful..
Moot now that @efiring merged it..
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.