Spaces:
Sleeping
Sleeping
Download tests/test_cli.py from EAT-Prototypes/jellyscope: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/EAT-Prototypes/jellyscope/resolve/main/tests/test_cli.py
- Command line
-
hf download hf://spaces/EAT-Prototypes/jellyscope/tests/test_cli.py
-
curl -L -o test_cli.py https://huggingface.co/spaces/EAT-Prototypes/jellyscope/resolve/main/tests/test_cli.py
1.19 kB
| """Tests for CLI entry point.""" | |
| from unittest.mock import patch | |
| from jellyscope.cli import main | |
| def test_main_default_args(): | |
| with ( | |
| patch("sys.argv", ["jellyscope", "--data-dir", "data"]), | |
| patch("jellyscope.cli.create_app") as mock_create_app, | |
| patch("jellyscope.cli.uvicorn") as mock_uvicorn, | |
| ): | |
| main() | |
| mock_create_app.assert_called_once() | |
| config = mock_create_app.call_args[0][0] | |
| assert config.host == "127.0.0.1" | |
| assert config.port == 5000 | |
| mock_uvicorn.run.assert_called_once() | |
| def test_main_custom_args(): | |
| with ( | |
| patch( | |
| "sys.argv", | |
| [ | |
| "jellyscope", | |
| "--host", | |
| "0.0.0.0", | |
| "--port", | |
| "8080", | |
| "--data-dir", | |
| "data", | |
| ], | |
| ), | |
| patch("jellyscope.cli.create_app") as mock_create_app, | |
| patch("jellyscope.cli.uvicorn") as mock_uvicorn, | |
| ): | |
| main() | |
| config = mock_create_app.call_args[0][0] | |
| assert config.host == "0.0.0.0" | |
| assert config.port == 8080 | |
| mock_uvicorn.run.assert_called_once() | |