Spaces:
Running on Zero
Running on Zero
Download tests/test_validators.py from maxmcd/Selectable-Face-Swap: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/spaces/maxmcd/Selectable-Face-Swap/resolve/main/tests/test_validators.py
- Command line
-
hf download hf://spaces/maxmcd/Selectable-Face-Swap/tests/test_validators.py
-
curl -L -o test_validators.py https://huggingface.co/spaces/maxmcd/Selectable-Face-Swap/resolve/main/tests/test_validators.py
1.37 kB
| import sys | |
| import pytest | |
| sys.path.insert(0, ".") | |
| from validators import _validate_target, _validate_selection, _validate_sources | |
| class TestValidateTarget: | |
| def test_empty_string_raises(self): | |
| with pytest.raises(Exception): | |
| _validate_target("") | |
| def test_null_string_raises(self): | |
| with pytest.raises(Exception): | |
| _validate_target("null") | |
| def test_whitespace_only_raises(self): | |
| with pytest.raises(Exception): | |
| _validate_target(" ") | |
| def test_valid_string_does_not_raise(self): | |
| _validate_target("data:image/jpeg;base64,abc") | |
| class TestValidateSelection: | |
| def test_empty_list_raises(self): | |
| with pytest.raises(Exception): | |
| _validate_selection([]) | |
| def test_non_empty_does_not_raise(self): | |
| _validate_selection([0]) | |
| _validate_selection([0, 2, 5]) | |
| class TestValidateSources: | |
| def test_missing_source_raises(self): | |
| with pytest.raises(Exception): | |
| _validate_sources([0, 1], {"0": "data:..."}) | |
| def test_empty_source_raises(self): | |
| with pytest.raises(Exception): | |
| _validate_sources([0], {"0": ""}) | |
| def test_all_present_does_not_raise(self): | |
| _validate_sources([0, 1], {"0": "data:...", "1": "data:..."}) | |
| def test_none_selected_does_not_raise(self): | |
| _validate_sources([], {}) | |