diff options
Diffstat (limited to 'tests/test_util_logging.py')
-rw-r--r-- | tests/test_util_logging.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_util_logging.py b/tests/test_util_logging.py new file mode 100644 index 000000000..d88d3cc6d --- /dev/null +++ b/tests/test_util_logging.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +""" + test_util_logging + ~~~~~~~~~~~~~~~~~ + + Test logging util. + + :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" +from __future__ import print_function + +from sphinx.util.logging import is_suppressed_warning + + +def test_is_suppressed_warning(): + suppress_warnings = ["ref", "files.*", "rest.duplicated_labels"] + + assert is_suppressed_warning(None, None, suppress_warnings) is False + assert is_suppressed_warning("ref", None, suppress_warnings) is True + assert is_suppressed_warning("ref", "numref", suppress_warnings) is True + assert is_suppressed_warning("ref", "option", suppress_warnings) is True + assert is_suppressed_warning("files", "image", suppress_warnings) is True + assert is_suppressed_warning("files", "stylesheet", suppress_warnings) is True + assert is_suppressed_warning("rest", "syntax", suppress_warnings) is False + assert is_suppressed_warning("rest", "duplicated_labels", suppress_warnings) is True |