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([], {})