[New-bugs-announce] [issue24922] assertWarnsRegex doesn't allow multiple warning messages
Cal Leeming
report at bugs.python.org
Mon Aug 24 16:15:48 CEST 2015
New submission from Cal Leeming:
There was a discussion/patch in #9754 [1].
This allows for multiple warning types as a tuple, e.g.;
self.assertWarnsRegex((DeprecationWarning, RuntimeWarning), "^E1000:")
However, it does not allow testing for multiple warning messages, e.g.;
expect = ((UserWarning, "^W1000"), (UserWarning, "^W1001"))
self.assertWarnsRegex(*expect)
This is slightly unexpected, as `test.support.check_warnings` allows this behaviour, e.g.
expect = ((UserWarning, "^W1000"), (UserWarning, "^W1001"))
check_warnings(*expect)
Therefore I am proposing that `assertWarnsRegex` and `assertWarns` are modified to reflect the behaviour of `check_warnings`, whilst ensuring backwards compatibility. (e.g. if arg[0] is tuple, use new approach, otherwise use old approach).
[1]: http://bugs.python.org/issue9754
----------
components: Interpreter Core
messages: 249048
nosy: sleepycal
priority: normal
severity: normal
status: open
title: assertWarnsRegex doesn't allow multiple warning messages
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24922>
_______________________________________
More information about the New-bugs-announce
mailing list