Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1409c6c

Browse files
committed
TST: Add backend bases test
1 parente0e2a62 commit1409c6c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

‎lib/matplotlib/tests/test_backend_bases.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
importimportlib
2+
fromunittest.mockimportpatch
23

34
frommatplotlibimportpath,transforms
45
frommatplotlib.backend_basesimport (
56
FigureCanvasBase,KeyEvent,LocationEvent,MouseButton,MouseEvent,
6-
NavigationToolbar2,RendererBase)
7+
NavigationToolbar2,RendererBase,TimerBase)
78
frommatplotlib.backend_toolsimportRubberbandBase
89
frommatplotlib.figureimportFigure
910
frommatplotlib.testing._markersimportneeds_pgf_xelatex
@@ -581,3 +582,24 @@ def test_interactive_pan_zoom_events(tool, button, patch_vis, forward_nav, t_s):
581582
# Check if twin-axes are properly triggered
582583
assertax_t.get_xlim()==pytest.approx(ax_t_twin.get_xlim(),abs=0.15)
583584
assertax_b.get_xlim()==pytest.approx(ax_b_twin.get_xlim(),abs=0.15)
585+
586+
587+
deftest_timer_properties():
588+
# Setting a property to the same value should not trigger the
589+
# private setter call again.
590+
timer=TimerBase(100)
591+
withpatch.object(timer,'_timer_set_interval')asmock:
592+
timer.interval=200
593+
mock.assert_called_once()
594+
asserttimer.interval==200
595+
timer.interval=200
596+
# Make sure it wasn't called again
597+
mock.assert_called_once()
598+
599+
withpatch.object(timer,'_timer_set_single_shot')asmock:
600+
timer.single_shot=True
601+
mock.assert_called_once()
602+
asserttimer._single
603+
timer.single_shot=True
604+
# Make sure it wasn't called again
605+
mock.assert_called_once()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp