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

Function test_complete

lib/matplotlib/tests/test_pickle.py:108–123  ·  view source on GitHub ↗
(fig_test, fig_ref)

Source from the content-addressed store, hash-verified

106@mpl.style.context("default")
107@check_figures_equal()
108def test_complete(fig_test, fig_ref):
109 _generate_complete_test_figure(fig_ref)
110 # plotting is done, now test its pickle-ability
111 pkl = pickle.dumps(fig_ref, pickle.HIGHEST_PROTOCOL)
112 # FigureCanvasAgg is picklable and GUI canvases are generally not, but there should
113 # be no reference to the canvas in the pickle stream in either case. In order to
114 # keep the test independent of GUI toolkits, run it with Agg and check that there's
115 # no reference to FigureCanvasAgg in the pickle stream.
116 assert "FigureCanvasAgg" not in [arg for op, arg, pos in pickletools.genops(pkl)]
117 loaded = pickle.loads(pkl)
118 loaded.canvas.draw()
119
120 fig_test.set_size_inches(loaded.get_size_inches())
121 fig_test.figimage(loaded.canvas.renderer.buffer_rgba())
122
123 plt.close(loaded)
124
125
126def _pickle_load_subprocess():

Callers

nothing calls this directly

Calls 7

set_size_inchesMethod · 0.80
get_size_inchesMethod · 0.80
figimageMethod · 0.80
drawMethod · 0.45
buffer_rgbaMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…