import pytest import re from soundchanger.change import apply def test_error_in_change(): with pytest.raises(ValueError, match=re.escape("Change is not a valid sound change. (Missing character '>')")): apply('', '') def test_error_split(): with pytest.raises(ValueError, match=re.escape("Change a>b/c/d is not a valid sound change. (More than one '/' character)")): apply('a>b/c/d', '') def test_error_in_environment(): with pytest.raises(ValueError, match=re.escape("Environment c is not a valid environment. (Character '_' should exist exactly once)")): apply('a>b/c', '') def test_no_change_from(): with pytest.raises(ValueError, match=re.escape("Nothing to change from.")): apply('>b', '')