MCPcopy Index your code
hub / github.com/RustPython/RustPython / assertRaisesRegex

Method assertRaisesRegex

Lib/unittest/case.py:1405–1419  ·  view source on GitHub ↗

Asserts that the message in a raised exception matches a regex. Args: expected_exception: Exception class expected to be raised. expected_regex: Regex (re.Pattern object or string) expected to be found in error message. args: Function

(self, expected_exception, expected_regex,
                          *args, **kwargs)

Source from the content-addressed store, hash-verified

1403 self.fail(self._formatMessage(msg, standardMsg))
1404
1405 def assertRaisesRegex(self, expected_exception, expected_regex,
1406 *args, **kwargs):
1407 """Asserts that the message in a raised exception matches a regex.
1408
1409 Args:
1410 expected_exception: Exception class expected to be raised.
1411 expected_regex: Regex (re.Pattern object or string) expected
1412 to be found in error message.
1413 args: Function to be called and extra positional args.
1414 kwargs: Extra kwargs.
1415 msg: Optional message used in case of failure. Can only be used
1416 when assertRaisesRegex is used as a context manager.
1417 """
1418 context = _AssertRaisesContext(expected_exception, self, expected_regex)
1419 return context.handle('assertRaisesRegex', args, kwargs)
1420
1421 def assertWarnsRegex(self, expected_warning, expected_regex,
1422 *args, **kwargs):

Calls 2

handleMethod · 0.45