Spaces:
Sleeping
Sleeping
Download tests/test_cli.py from Tanish2416/RepoRepair: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/Tanish2416/RepoRepair/resolve/main/tests/test_cli.py
- Command line
-
hf download hf://spaces/Tanish2416/RepoRepair/tests/test_cli.py
-
curl -L -o test_cli.py https://huggingface.co/spaces/Tanish2416/RepoRepair/resolve/main/tests/test_cli.py
1.15 kB
| """Tests for CLI functionality.""" | |
| import pytest | |
| from typer import BadParameter | |
| from cli.main import validate_github_url | |
| def test_validate_github_url_valid(): | |
| """Test valid GitHub URL validation.""" | |
| url = "https://github.com/owner/repo/issues/123" | |
| owner, repo, issue_num = validate_github_url(url) | |
| assert owner == "owner" | |
| assert repo == "repo" | |
| assert issue_num == 123 | |
| def test_validate_github_url_invalid(): | |
| """Test invalid GitHub URL validation.""" | |
| invalid_urls = [ | |
| "https://github.com/owner/repo", | |
| "https://gitlab.com/owner/repo/issues/123", | |
| "not a url", | |
| "https://github.com/owner/repo/pull/123", | |
| ] | |
| for url in invalid_urls: | |
| with pytest.raises(BadParameter): | |
| validate_github_url(url) | |
| def test_validate_github_url_with_different_numbers(): | |
| """Test URL validation with different issue numbers.""" | |
| url = "https://github.com/test/project/issues/9999" | |
| owner, repo, issue_num = validate_github_url(url) | |
| assert owner == "test" | |
| assert repo == "project" | |
| assert issue_num == 9999 | |