-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce ToolkitError base exception class
- Loading branch information
Showing
8 changed files
with
64 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
"""Global zhinst-toolkit exceptions.""" | ||
|
||
|
||
class ValidationError(Exception): | ||
"""Data validation failed.""" | ||
class ToolkitError(RuntimeError): | ||
"""Base class for `zhinst.toolkit` errors. | ||
.. versionadded:: 0.5.2 | ||
""" | ||
|
||
|
||
class ValidationError(ToolkitError): | ||
"""Data validation failed. | ||
.. versionchanged:: 0.5.2 | ||
Changed base class from `Exception` to `ToolkitError`. | ||
""" |
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
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,12 @@ | ||
import pytest | ||
|
||
from zhinst.toolkit.exceptions import ToolkitError | ||
|
||
|
||
def test_base_exception(): | ||
assert issubclass(ToolkitError, RuntimeError) | ||
|
||
|
||
def test_base_exception_raises(): | ||
with pytest.raises(RuntimeError): | ||
raise ToolkitError("message") |