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

Function test_grabframe

lib/matplotlib/tests/test_animation.py:205–229  ·  view source on GitHub ↗
(tmp_path, writer, frame_format, output)

Source from the content-addressed store, hash-verified

203
204@pytest.mark.parametrize('writer, frame_format, output', gen_writers())
205def test_grabframe(tmp_path, writer, frame_format, output):
206 WriterClass = animation.writers[writer]
207
208 if frame_format is not None:
209 plt.rcParams["animation.frame_format"] = frame_format
210
211 fig, ax = plt.subplots()
212
213 dpi = None
214 codec = None
215 if writer == 'ffmpeg':
216 # Issue #8253
217 fig.set_size_inches((10.85, 9.21))
218 dpi = 100.
219 codec = 'h264'
220
221 test_writer = WriterClass()
222 with test_writer.saving(fig, tmp_path / output, dpi):
223 # smoke test it works
224 test_writer.grab_frame()
225 for k in {'dpi', 'bbox_inches', 'format'}:
226 with pytest.raises(
227 TypeError,
228 match=f"grab_frame got an unexpected keyword argument {k!r}"):
229 test_writer.grab_frame(**{k: object()})
230
231
232@pytest.mark.parametrize('writer', [

Callers

nothing calls this directly

Calls 4

set_size_inchesMethod · 0.80
savingMethod · 0.80
subplotsMethod · 0.45
grab_frameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…