Skip to content

Commit

Permalink
Improve a test for ValidationException str
Browse files Browse the repository at this point in the history
  • Loading branch information
insolor committed Oct 2, 2023
1 parent 6567c59 commit 54906b5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/test_validation_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[
(ProblemSeverity.ERROR, "Error"),
(ProblemSeverity.WARNING, "Warning"),
]
],
)
def test_problem_severity_str(test_data, expected):
assert str(test_data) == expected
Expand All @@ -19,7 +19,7 @@ def test_problem_severity_str(test_data, expected):
[
(ValidationProblem("Error message"), "Error: Error message"),
(ValidationProblem("Warning message", ProblemSeverity.WARNING), "Warning: Warning message"),
]
],
)
def test_validation_problem_str(test_data, expected):
assert str(test_data) == expected
Expand All @@ -30,7 +30,7 @@ def test_validation_problem_str(test_data, expected):
[
([ValidationProblem("Error")], True),
([ValidationProblem("Warning", ProblemSeverity.WARNING)], False),
]
],
)
def test_validation_problem_contains_errors(test_data, expected):
assert ValidationProblem.contains_errors(test_data) == expected
Expand All @@ -39,9 +39,12 @@ def test_validation_problem_contains_errors(test_data, expected):
@pytest.mark.parametrize(
"test_data, expected",
[
([ValidationProblem("Error message")], "Error: Error message"),
(
[ValidationProblem("Error message"), ValidationProblem("Warning message", ProblemSeverity.WARNING)],
"Error: Error message\nWarning: Warning message",
),
([ValidationProblem("Warning message", ProblemSeverity.WARNING)], "Warning: Warning message"),
]
],
)
def test_validation_exception_str(test_data, expected):
assert str(ValidationException(test_data)) == expected

0 comments on commit 54906b5

Please sign in to comment.