-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement custom exceptions for specific error situations (#60)
- Loading branch information
1 parent
7c869ce
commit 6c9b2ba
Showing
5 changed files
with
25 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class MissingArtifactException(ValueError): | ||
"""Exception raised when an artifact cannot be found.""" | ||
|
||
pass |
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,13 @@ | ||
import pytest | ||
|
||
from articat.catalog_local import CatalogLocal | ||
from articat.exceptions import MissingArtifactException | ||
|
||
|
||
def test_catalog_local_missing_artifact_exception(): | ||
""" | ||
Test that `MissingArtifactException` is raised when an artifact cannot be found in `CatalogLocal`. | ||
""" | ||
catalog = CatalogLocal() | ||
with pytest.raises(MissingArtifactException, match="Can't find requested artifact"): | ||
catalog.get("non_existing_artifact_id") |
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