[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

Serhiy Storchaka report at bugs.python.org
Tue May 19 11:14:28 CEST 2015


Serhiy Storchaka added the comment:

Core developers left a couple of notes and the patch itself is outdated. Here is updated patch that addresses all comments. It also extends the checking to assertRaisesRegex(), assertWarns() and assertWarnsRegex().

There is a risk to break existing incorrect tests if the argument is a tuple. They can be passed for now because caught exception or warning is found before incorrect value. For example:

    with self.assertRaises((ValueError, None)):
        int('a')

----------
Added file: http://bugs.python.org/file39426/issue15836_2.patch

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


More information about the Python-bugs-list mailing list