-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
629 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
|
||
from mozilla_version.errors import PatternNotMatchedError | ||
|
||
|
||
@pytest.mark.parametrize('string, patterns, expected_message', (( | ||
'some string', | ||
['one single pattern'], | ||
'"some string" does not match the pattern: one single pattern', | ||
), ( | ||
'some string', | ||
['one pattern', 'two patterns'], | ||
'''"some string" does not match the patterns: | ||
- one pattern | ||
- two patterns''', | ||
))) | ||
def test_pattern_not_matched_error_changes_its_error_message(string, patterns, expected_message): | ||
with pytest.raises(PatternNotMatchedError) as exc_info: | ||
raise PatternNotMatchedError(string, patterns) | ||
|
||
assert exc_info.value.args == (expected_message,) | ||
|
||
|
||
def test_pattern_not_matched_error_raises_if_badly_initialized(): | ||
with pytest.raises(ValueError) as exc_info: | ||
raise PatternNotMatchedError('some string', patterns=()) | ||
|
||
assert exc_info.value.args == ('At least one pattern must be provided',) |
Oops, something went wrong.