-
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.
Fix support for single mitigation (#30)
- Loading branch information
Showing
2 changed files
with
53 additions
and
2 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,46 @@ | ||
import io | ||
from inspect import cleandoc | ||
|
||
from exasol.error._parse import parse_file | ||
from exasol.error._report import ErrorCodeDetails | ||
|
||
|
||
# regression test for GitHub Issue #26 | ||
def test_single_mitigation(): | ||
f = io.StringIO(initial_value=cleandoc( | ||
""" | ||
from exasol import error | ||
from exasol.error import Parameter | ||
var = input("description: ") | ||
error1 = error.ExaError( | ||
"E-TEST-1", | ||
"this is an error", | ||
"no mitigation available", | ||
{}, | ||
) | ||
""" | ||
)) | ||
|
||
expected_definitions = [ | ||
ErrorCodeDetails( | ||
identifier='E-TEST-1', | ||
message='this is an error', | ||
messagePlaceholders=[], | ||
description=None, | ||
internalDescription=None, | ||
potentialCauses=None, | ||
mitigations=['no mitigation available'], | ||
sourceFile='<StringIO>', | ||
sourceLine=6, | ||
contextHash=None), | ||
] | ||
expected_warnings = [] | ||
expected_errors = [] | ||
|
||
definitions, warnings, errors = parse_file(f) | ||
|
||
assert expected_definitions == definitions | ||
assert expected_warnings == warnings | ||
assert expected_errors == errors |