Message322946
Currently assertRaises(), assertRaisesRegex(), assertWarns() and assertWarnsRegex() have some weird behavior.
# always success if the callable is None
self.assertRaises(SomeException, None)
# keyword arguments except "msg" are ignored
with self.assertRaises(SomeException, foobar=123):
...
# always success because keyword arguments are ignored
self.assertRaises(SomeException, callable=func)
Hardly any user code uses these "features" intentionally. More likely such examples are hidden bugs (see for example [1]). A DeprecationWarning is raised in these cases since 3.5 (issue24134), and it is time to make them errors.
[1] https://mail.python.org/pipermail/python-list/2018-July/736363.html |
|
Date |
User |
Action |
Args |
2018-08-02 11:39:54 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rbcollins, ezio.melotti, michael.foord |
2018-08-02 11:39:54 | serhiy.storchaka | set | messageid: <1533209994.63.0.56676864532.issue34318@psf.upfronthosting.co.za> |
2018-08-02 11:39:54 | serhiy.storchaka | link | issue34318 messages |
2018-08-02 11:39:54 | serhiy.storchaka | create | |
|