MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_animation_repr_html

Function test_animation_repr_html

lib/matplotlib/tests/test_animation.py:248–270  ·  view source on GitHub ↗
(writer, html, want, anim)

Source from the content-addressed store, hash-verified

246])
247@pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim'])
248def test_animation_repr_html(writer, html, want, anim):
249 if platform.python_implementation() == 'PyPy':
250 # Something in the test setup fixture lingers around into the test and
251 # breaks pytest.warns on PyPy. This garbage collection fixes it.
252 # https://foss.heptapod.net/pypy/pypy/-/issues/3536
253 np.testing.break_cycles()
254 if (writer == 'imagemagick' and html == 'html5'
255 # ImageMagick delegates to ffmpeg for this format.
256 and not animation.FFMpegWriter.isAvailable()):
257 pytest.skip('Requires FFMpeg')
258 # create here rather than in the fixture otherwise we get __del__ warnings
259 # about producing no output
260 anim = animation.FuncAnimation(**anim)
261 with plt.rc_context({'animation.writer': writer,
262 'animation.html': html}):
263 html = anim._repr_html_()
264 if want is None:
265 assert html is None
266 with pytest.warns(UserWarning):
267 del anim # Animation was never run, so will warn on cleanup.
268 np.testing.break_cycles()
269 else:
270 assert want in html
271
272
273@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

isAvailableMethod · 0.45
_repr_html_Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…