(writer, html, want, anim)
| 246 | ]) |
| 247 | @pytest.mark.parametrize('anim', [dict(klass=dict)], indirect=['anim']) |
| 248 | def 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( |
nothing calls this directly
no test coverage detected
searching dependent graphs…