AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Refactor test_spiunner to deprecate unittest in favor of pytest (#3532)
Media4f72ee7815e3
diff --git a/tests/unit/test_spinner.py b/tests/unit/test_spinner.pyindex 16106f429c..1c5c3ac00e 100644--- a/tests/unit/test_spinner.py+++ b/tests/unit/test_spinner.py@@ -1,6 +1,5 @@# Generated by CodiumAIimport time-import unittestfrom autogpt.spinner import Spinner@@ -29,40 +28,43 @@ ALMOST_DONE_MESSAGE = "Almost done..."PLEASE_WAIT = "Please wait..."-class TestSpinner(unittest.TestCase):- def test_spinner_initializes_with_default_values(self):- """Tests that the spinner initializes with default values."""- with Spinner() as spinner:- self.assertEqual(spinner.message, "Loading...")- self.assertEqual(spinner.delay, 0.1)-- def test_spinner_initializes_with_custom_values(self):- """Tests that the spinner initializes with custom message and delay values."""- with Spinner(message=PLEASE_WAIT, delay=0.2) as spinner:- self.assertEqual(spinner.message, PLEASE_WAIT)- self.assertEqual(spinner.delay, 0.2)-- #- def test_spinner_stops_spinning(self):- """Tests that the spinner starts spinning and stops spinning without errors."""- with Spinner() as spinner:- time.sleep(1)- spinner.update_message(ALMOST_DONE_MESSAGE)- time.sleep(1)- self.assertFalse(spinner.running)-- def test_spinner_updates_message_and_still_spins(self):- """Tests that the spinner message can be updated while the spinner is running and the spinner continues spinning."""- with Spinner() as spinner:- self.assertTrue(spinner.running)- time.sleep(1)- spinner.update_message(ALMOST_DONE_MESSAGE)- time.sleep(1)- self.assertEqual(spinner.message, ALMOST_DONE_MESSAGE)- self.assertFalse(spinner.running)-- def test_spinner_can_be_used_as_context_manager(self):- """Tests that the spinner can be used as a context manager."""- with Spinner() as spinner:- self.assertTrue(spinner.running)- self.assertFalse(spinner.running)+def test_spinner_initializes_with_default_values():+ """Tests that the spinner initializes with default values."""+ with Spinner() as spinner:+ assert spinner.message == "Loading..."+ assert spinner.delay == 0.1+++def test_spinner_initializes_with_custom_values():+ """Tests that the spinner initializes with custom message and delay values."""+ with Spinner(message=PLEASE_WAIT, delay=0.2) as spinner:+ assert spinner.message == PLEASE_WAIT+ assert spinner.delay == 0.2+++#+def test_spinner_stops_spinning():+ """Tests that the spinner starts spinning and stops spinning without errors."""+ with Spinner() as spinner:+ time.sleep(1)+ spinner.update_message(ALMOST_DONE_MESSAGE)+ time.sleep(1)+ assert spinner.running == False+++def test_spinner_updates_message_and_still_spins():+ """Tests that the spinner message can be updated while the spinner is running and the spinner continues spinning."""+ with Spinner() as spinner:+ assert spinner.running == True+ time.sleep(1)+ spinner.update_message(ALMOST_DONE_MESSAGE)+ time.sleep(1)+ assert spinner.message == ALMOST_DONE_MESSAGE+ assert spinner.running == False+++def test_spinner_can_be_used_as_context_manager():+ """Tests that the spinner can be used as a context manager."""+ with Spinner() as spinner:+ assert spinner.running == True+ assert spinner.running == False