assert_raises_regex(exception_class, expected_regexp, callable, *args, **kwargs) assert_raises_regex(exception_class, expected_regexp) Fail unless an exception of class exception_class and with message that matches expected_regexp is thrown by callable when
(exception_class, expected_regexp, *args, **kwargs)
| 1296 | |
| 1297 | |
| 1298 | def assert_raises_regex(exception_class, expected_regexp, *args, **kwargs): |
| 1299 | """ |
| 1300 | assert_raises_regex(exception_class, expected_regexp, callable, *args, |
| 1301 | **kwargs) |
| 1302 | assert_raises_regex(exception_class, expected_regexp) |
| 1303 | |
| 1304 | Fail unless an exception of class exception_class and with message that |
| 1305 | matches expected_regexp is thrown by callable when invoked with arguments |
| 1306 | args and keyword arguments kwargs. |
| 1307 | |
| 1308 | Alternatively, can be used as a context manager like `assert_raises`. |
| 1309 | |
| 1310 | Notes |
| 1311 | ----- |
| 1312 | .. versionadded:: 1.9.0 |
| 1313 | |
| 1314 | """ |
| 1315 | __tracebackhide__ = True # Hide traceback for py.test |
| 1316 | return _d.assertRaisesRegex(exception_class, expected_regexp, *args, **kwargs) |
| 1317 | |
| 1318 | |
| 1319 | def decorate_methods(cls, decorator, testmatch=None): |
no outgoing calls