(fig_test, fig_ref)
| 106 | @mpl.style.context("default") |
| 107 | @check_figures_equal() |
| 108 | def 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 | |
| 126 | def _pickle_load_subprocess(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…