MCPcopy Create free account
hub / github.com/ipython/ipython / test_select_figure_formats_kwargs

Function test_select_figure_formats_kwargs

IPython/core/tests/test_pylabtools.py:100–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98 nt.assert_not_in(Figure, f)
99
100def test_select_figure_formats_kwargs():
101 ip = get_ipython()
102 kwargs = dict(quality=10, bbox_inches='tight')
103 pt.select_figure_formats(ip, 'png', **kwargs)
104 formatter = ip.display_formatter.formatters['image/png']
105 f = formatter.lookup_by_type(Figure)
106 cell = f.__closure__[0].cell_contents
107 nt.assert_equal(cell, kwargs)
108
109 # check that the formatter doesn't raise
110 fig = plt.figure()
111 ax = fig.add_subplot(1,1,1)
112 ax.plot([1,2,3])
113 plt.draw()
114 formatter.enabled = True
115 png = formatter(fig)
116 assert png.startswith(_PNG)
117
118def test_select_figure_formats_set():
119 ip = get_ipython()

Callers

nothing calls this directly

Calls 2

get_ipythonFunction · 0.90
lookup_by_typeMethod · 0.80

Tested by

no test coverage detected