[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

Ezio Melotti report at bugs.python.org
Mon Feb 10 08:52:29 CET 2014


Ezio Melotti added the comment:

The two signatures of assertRaisesRegex are:
assertRaisesRegex(exception, regex, callable, *args, **kwds)
assertRaisesRegex(exception, regex, msg=None)

IIUC what you are saying is that if you forget the regex and call assertRaisesRegex(exception, callable) the test will pass.

I think it would be ok to add a check to see if the second argument is a callable or None (or maybe check if it's a string or regex object?), and give an appropriate error message if it's not.

----------
keywords: +easy

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20145>
_______________________________________


More information about the Python-bugs-list mailing list