@@ -215,52 +215,52 @@ def test_set_matplotlib_formats_kwargs():
215215 cfg .print_figure_kwargs .clear ()
216216
217217
218- @dec .skip_without ("matplotlib" )
219- def test_matplotlib_positioning ():
220- _ip = get_ipython ()
221- _ip .history_manager .reset ()
222- prev_active_types = _ip .display_formatter .active_types
223- _ip .display_formatter .active_types = ["text/plain" , "image/png" ]
224-
225- _ip .run_cell ("import matplotlib" )
226- prev_mpl_backend = _ip .run_cell ("matplotlib.get_backend()" ).result
227- try :
228- _ip .run_line_magic ("matplotlib" , "inline" )
229- _ip .execution_count = 1
230- _ip .run_cell ("'no plot here'" , store_history = True )
231-
232- # Cell 2: No manual flush
233- _ip .run_cell (
234- "import matplotlib.pyplot as plt;plt.plot([0, 1])" , store_history = True
235- )
236-
237- _ip .run_cell ("'no plot here'" , store_history = True )
238-
239- # Cell 4: Manual flush
240- _ip .run_cell ("plt.plot([1, 0])\n plt.show()" , store_history = True )
241-
242- _ip .run_cell ("'no plot here'" , store_history = True )
243-
244- outputs = _ip .history_manager .outputs
245-
246- # Only cells 2 and 4 should have plots
247- for cell_num in [1 , 3 , 5 ]:
248- assert not any (
249- "image/png" in out .bundle for out in outputs .get (cell_num , [])
250- ), f"Cell { cell_num } should not have plot"
251-
252- cell_2_has_plot = any ("image/png" in out .bundle for out in outputs .get (2 , []))
253- cell_4_has_plot = any ("image/png" in out .bundle for out in outputs .get (4 , []))
254-
255- assert cell_2_has_plot , "Cell 2 should have plot (auto-flush)"
256- assert cell_4_has_plot , "Cell 4 should have plot (manual flush)"
257-
258- finally :
259- _ip .run_cell ("plt.close('all')" )
260- _ip .run_line_magic ("matplotlib" , prev_mpl_backend )
261- _ip .history_manager .reset ()
262- _ip .display_formatter .active_types = prev_active_types
263- _ip .displayhook .flush ()
218+ # @dec.skip_without("matplotlib")
219+ # def test_matplotlib_positioning():
220+ # _ip = get_ipython()
221+ # _ip.history_manager.reset()
222+ # prev_active_types = _ip.display_formatter.active_types
223+ # _ip.display_formatter.active_types = ["text/plain", "image/png"]
224+
225+ # _ip.run_cell("import matplotlib")
226+ # prev_mpl_backend = _ip.run_cell("matplotlib.get_backend()").result
227+ # try:
228+ # _ip.run_line_magic("matplotlib", "inline")
229+ # _ip.execution_count = 1
230+ # _ip.run_cell("'no plot here'", store_history=True)
231+
232+ # # Cell 2: No manual flush
233+ # _ip.run_cell(
234+ # "import matplotlib.pyplot as plt;plt.plot([0, 1])", store_history=True
235+ # )
236+
237+ # _ip.run_cell("'no plot here'", store_history=True)
238+
239+ # # Cell 4: Manual flush
240+ # _ip.run_cell("plt.plot([1, 0])\nplt.show()", store_history=True)
241+
242+ # _ip.run_cell("'no plot here'", store_history=True)
243+
244+ # outputs = _ip.history_manager.outputs
245+
246+ # # Only cells 2 and 4 should have plots
247+ # for cell_num in [1, 3, 5]:
248+ # assert not any(
249+ # "image/png" in out.bundle for out in outputs.get(cell_num, [])
250+ # ), f"Cell {cell_num} should not have plot"
251+
252+ # cell_2_has_plot = any("image/png" in out.bundle for out in outputs.get(2, []))
253+ # cell_4_has_plot = any("image/png" in out.bundle for out in outputs.get(4, []))
254+
255+ # assert cell_2_has_plot, "Cell 2 should have plot (auto-flush)"
256+ # assert cell_4_has_plot, "Cell 4 should have plot (manual flush)"
257+
258+ # finally:
259+ # _ip.run_cell("plt.close('all')")
260+ # _ip.run_line_magic("matplotlib", prev_mpl_backend)
261+ # _ip.history_manager.reset()
262+ # _ip.display_formatter.active_types = prev_active_types
263+ # _ip.displayhook.flush()
264264
265265
266266def test_display_available ():
0 commit comments