mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-02-23 15:14:44 +01:00
* Fix all but one flake8 linting errors * Remove unused imports * Wrap strings that are too long * Add basic autogpts/autogpt/.flake8 * Delete planning_agent.py * Delete default_prompts.py * Delete _test_json_parser.py * Refactor the example function call in AgentProfileGeneratorConfiguration from a string to an object * Rewrite/update docstrings here and there while I'm at it * Minor change to the description of the `open_file` command * Use `user-agent` from config in web_selenium.py * Delete hardcoded ABILITIES from core/planning/templates.py * Delete duplicate and superseded test from test_image_gen.py * Fix parameter definitions in mock_commands.py * Delete code analysis blocks from test_spinner.py, test_url_validation.py
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
import time
|
|
|
|
from autogpt.app.spinner import Spinner
|
|
|
|
ALMOST_DONE_MESSAGE = "Almost done..."
|
|
PLEASE_WAIT = "Please wait..."
|
|
|
|
|
|
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)
|
|
assert not spinner.running
|
|
|
|
|
|
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
|
|
assert not spinner.running
|