[Python-checkins] r78758 - in python/trunk: Lib/test/string_tests.py Lib/test/test_ascii_formatd.py Lib/test/test_fileio.py Lib/test/test_index.py Lib/test/test_random.py Lib/test/test_support.py Lib/test/test_unicode.py Misc/NEWS

Mark Dickinson dickinsm at gmail.com
Sun Mar 7 16:17:40 CET 2010


On Sun, Mar 7, 2010 at 12:18 PM, florent.xicluna
<python-checkins at python.org> wrote:
> Author: florent.xicluna
> Date: Sun Mar  7 13:18:33 2010
> New Revision: 78758
>> Log:
> Issue #7849: Now the utility ``check_warnings`` verifies if the warnings are
> effectively raised.  A new utility ``check_py3k_warnings`` deals with py3k warnings.

> Modified: python/trunk/Lib/test/test_support.py
> ==============================================================================
[...]
> +    for filter in missing:
> +        raise AssertionError("filter (%r, %s) did not caught any warning" %
> +                             filter)

"did not caught" -> "did not catch" :)
> + at contextlib.contextmanager
> +def check_warnings(*filters, **kwargs):
> +    """Context manager to silence warnings.
> +
> +    Accept 2-tuples as positional arguments:
> +        ("message regexp", WarningCategory)

What's the reason for only allowing filtering on the warning category
and message, but not on line number and module?
Mark


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /