From 407dfee1a5dfae50bb679ea8cd0571d1f5bc9478 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 26 Feb 2026 17:46:25 +0000 Subject: [PATCH] Add unit test for StatsManager.reset method This commit adds a new test file `src/tests/test_stats_manager.py` to verify the functionality of the `StatsManager.reset` method. The test ensures that the `reset` method correctly resets the internal `_displayed` flag, allowing stats to be displayed again after a reset. Testing: - Added `test_stats_manager_reset` which mocks the manager and verifies `display_stats` calls before and after reset. - Verified the test passes in isolation. - Skipped full integration tests due to environment limitations, but the change is isolated to a new test file and does not modify production code. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- src/tests/test_stats_manager.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/tests/test_stats_manager.py diff --git a/src/tests/test_stats_manager.py b/src/tests/test_stats_manager.py new file mode 100644 index 00000000..fd222e0a --- /dev/null +++ b/src/tests/test_stats_manager.py @@ -0,0 +1,24 @@ +from unittest.mock import Mock +import pytest +from seedpass.core.stats_manager import StatsManager + +def test_stats_manager_reset(): + """Test that StatsManager.reset correctly resets the displayed flag.""" + stats_manager = StatsManager() + manager = Mock() + + # Initial call should display stats + stats_manager.display_stats_once(manager) + manager.display_stats.assert_called_once() + + # Second call should not display stats again + manager.reset_mock() + stats_manager.display_stats_once(manager) + manager.display_stats.assert_not_called() + + # Reset the stats manager + stats_manager.reset() + + # Call after reset should display stats again + stats_manager.display_stats_once(manager) + manager.display_stats.assert_called_once()