-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds tests for parser error handling
- Loading branch information
1 parent
c25e279
commit 2679fd8
Showing
2 changed files
with
24 additions
and
9 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,17 @@ | ||
"""Tests for the ``cli.BaseParser`` class""" | ||
|
||
from unittest import TestCase | ||
|
||
from shinigami.cli import BaseParser | ||
|
||
|
||
class ErrorHandling(TestCase): | ||
"""Test parser errors are properly raised and reported""" | ||
|
||
def test_system_exit_error(self) -> None: | ||
"""Test parser errors are raised as ``SystemExit`` exceptions""" | ||
|
||
message = 'This is an error message' | ||
with self.assertRaises(SystemExit) as error: | ||
BaseParser().error(message) | ||
self.assertEqual(message, error) |