Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
FIX: Correct variable name from _frame to _frames in PillowWriter class#29520
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join uson gitter for real-time discussion.
For details on testing, writing docs, and our review process, please seethe developer guide
We strive to be a welcoming and open project. Please follow ourCode of Conduct.
@rcomer can you take a look at it later, please? |
@@ -526,3 +526,31 @@ def test_movie_writer_invalid_path(anim): | |||
with pytest.raises(FileNotFoundError, match=match_str): | |||
anim.save("/foo/bar/aardvark/thiscannotreallyexist.mp4", | |||
writer=animation.FFMpegFileWriter()) | |||
def test_exhausted_animation_with_transparency(tmp_path): |
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.
What exactly is the purpose of the test?
From a quick reading it is
- a smoke test to exercise the anim code path for transparency
- testing that a saved animation is exhausted.
Can you please describe more precisely what the test wants to ensure? Also it seems (2) is quite unrelated to transparency.
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.
The goal of this test is to actually verify the non-covered section:
ifim.getextrema()[3][0]<255:# This frame has transparency, so we'll just add it as is.self._frames.append(im)
viasavefig_kwargs={"transparent": True}
.
I tried just to mock up theclass PillowWriter(AbstractMovieWriter):
, but it actually raise an error thatsavefig_kwargs={"transparent": True}
is not included. Consequently, I extended a little bit the test. Considering, to leave this part out?
# Verify exhausted warningwithpytest.warns(UserWarning,match="exhausted"):anim._start()
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.
@timhoffm what about this test? Only using the PillowWriter?
deftest_animation_with_transparency():"""Test animation exhaustion with transparency using PillowWriter directly"""fig,ax=plt.subplots()rect=plt.Rectangle((0,0),1,1,color='red',alpha=0.5)ax.add_patch(rect)ax.set_xlim(0,1)ax.set_ylim(0,1)writer=PillowWriter(fps=30)writer.setup(fig,'unused.gif',dpi=100)writer.grab_frame(transparent=True)frame=writer._frames[-1]# Check that the alpha channel is not 255, so frame has transparencyassertframe.getextrema()[3][0]<255plt.close(fig)
so the missing part is also captured? thx for feedback

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.
If former test fits better, I will submit a revert commit
6c5e3f3
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
…to _frames in PillowWriter class
…520-on-v3.10.xBackport PR#29520 on branch v3.10.x (FIX: Correct variable name from _frame to _frames in PillowWriter class)
Uh oh!
There was an error while loading.Please reload this page.
PR summary
Correct the variable name from
_frame
to_frames
in the PillowWriter class to ensure proper functionality.PR checklist