From f31b954bd7706ccaef7dcb56a326bd470c063955 Mon Sep 17 00:00:00 2001 From: Storsorken Date: Sun, 5 Mar 2023 20:20:26 +0100 Subject: [PATCH] tests: #11 add test for invalid argument Tests invalid argument to start method in ExtendedLoopingCall class throws ValueError --- evennia/scripts/tests.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/evennia/scripts/tests.py b/evennia/scripts/tests.py index 51a244a1c9..aa0b97d1ec 100644 --- a/evennia/scripts/tests.py +++ b/evennia/scripts/tests.py @@ -143,6 +143,13 @@ class TestExtendedLoopingCall(TestCase): self.assertEqual(loopcall.interval, 20) loopcall._scheduleFrom.assert_called_with(121) + def test_start_invalid_interval(self): + """ Test the .start method with interval less than zero """ + with self.assertRaises(ValueError): + callback = mock.MagicMock() + loopcall = ExtendedLoopingCall(callback) + loopcall.start(-1, now=True, start_delay=None, count_start=1) + def dummy_func(): return 0 class TestMonitorHandler(TestCase):