Skip to content

Commit

Permalink
Better assert message for documentation tests (#6575)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed May 11, 2022
1 parent c6022aa commit 3721bef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/test_messages_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ def _runTest(self) -> None:
expected_messages = self._get_expected()
actual_messages = self._get_actual()
if self.is_good_test_file():
assert actual_messages.total() == 0 # type: ignore[attr-defined]
msg = "There should be no warning raised for 'good.py'"
assert actual_messages.total() == 0, msg # type: ignore[attr-defined]
if self.is_bad_test_file():
assert actual_messages.total() > 0 # type: ignore[attr-defined]
msg = "There should be at least one warning raised for 'bad.py'"
assert actual_messages.total() > 0, msg # type: ignore[attr-defined]
assert expected_messages == actual_messages


Expand Down

0 comments on commit 3721bef

Please sign in to comment.