Skip to content

Commit

Permalink
add tests to webagg and 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 f8a3028
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"

Check warning on line 204 in lib/matplotlib/tests/test_backend_tk.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/tests/test_backend_tk.py#L204

Added line #L204 was not covered by tests
with mock.patch(prop, return_value=("foobar.png", None)):
fname = fig.canvas.manager.toolbar.save_figure()
os.remove("foobar.png")
assert fname == "foobar.png"
print("success")

Check warning on line 209 in lib/matplotlib/tests/test_backend_tk.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/tests/test_backend_tk.py#L206-L209

Added lines #L206 - L209 were not covered by tests


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

0 comments on commit f8a3028

Please sign in to comment.