Skip to content

Commit

Permalink
add tests to tk backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Zybulon committed Feb 11, 2024
1 parent c58a062 commit c474811
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/matplotlib/tests/test_backend_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,19 @@ class Toolbar(NavigationToolbar2Tk):
print("success")


@_isolated_tk_test(success_count=1)
def test_save_figure_return():
import matplotlib.pyplot as plt
from unittest import mock
fig = plt.figure()
prop = "tkinter.filedialog.asksaveasfilename"
with mock.patch(prop, return_value="foobar.png"):
fname = fig.canvas.manager.toolbar.save_figure()
os.remove("foobar.png")
assert fname == "foobar.png"
print("success")


@_isolated_tk_test(success_count=1)
def test_canvas_focus():
import tkinter as tk
Expand Down

0 comments on commit c474811

Please sign in to comment.