From b9d7e7f73eee09ebd33e9c8505c5d0c4d8866dcf Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Fri, 13 Feb 2026 13:22:13 -0600 Subject: [PATCH] Backport PR #31153: TST: Use correct method of clearing mock objects --- lib/matplotlib/tests/test_backends_interactive.py | 2 +- lib/matplotlib/tests/test_colors.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index 4e3c1bbc2bb5..594681391e61 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -648,7 +648,7 @@ def _impl_test_interactive_timers(): assert mock.call_count > 1 # Now turn it into a single shot timer and verify only one gets triggered - mock.call_count = 0 + mock.reset_mock() timer.single_shot = True timer.start() plt.pause(pause_time) diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index 7da4bab69c15..7ca9c0f77858 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -1590,7 +1590,7 @@ def test_norm_callback(): assert increment.call_count == 2 # We only want autoscale() calls to send out one update signal - increment.call_count = 0 + increment.reset_mock() norm.autoscale([0, 1, 2]) assert increment.call_count == 1