MCPcopy Create free account
hub / github.com/numpy/numpy / assert_raises_regex

Function assert_raises_regex

numpy/testing/_private/utils.py:1298–1316  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1296
1297
1298def 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
1319def decorate_methods(cls, decorator, testmatch=None):

Callers 15

test_stackFunction · 0.90
test_exceptionsMethod · 0.90
test_stackFunction · 0.90
test_invalid_nestingMethod · 0.90
test_empty_listsMethod · 0.90
test_tupleMethod · 0.90
test_methodMethod · 0.90
test_no_wrapperMethod · 0.90
test_not_implementedMethod · 0.90
test_not_implementedMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_stackFunction · 0.72
test_exceptionsMethod · 0.72
test_stackFunction · 0.72
test_invalid_nestingMethod · 0.72
test_empty_listsMethod · 0.72
test_tupleMethod · 0.72
test_methodMethod · 0.72
test_no_wrapperMethod · 0.72
test_not_implementedMethod · 0.72
test_not_implementedMethod · 0.72