Fail the test if the text matches the regular expression.
(self, text, unexpected_regex, msg=None)
| 1445 | raise self.failureException(msg) |
| 1446 | |
| 1447 | def assertNotRegex(self, text, unexpected_regex, msg=None): |
| 1448 | """Fail the test if the text matches the regular expression.""" |
| 1449 | if isinstance(unexpected_regex, (str, bytes)): |
| 1450 | unexpected_regex = re.compile(unexpected_regex) |
| 1451 | match = unexpected_regex.search(text) |
| 1452 | if match: |
| 1453 | standardMsg = 'Regex matched: %r matches %r in %r' % ( |
| 1454 | text[match.start() : match.end()], |
| 1455 | unexpected_regex.pattern, |
| 1456 | text) |
| 1457 | # _formatMessage ensures the longMessage option is respected |
| 1458 | msg = self._formatMessage(msg, standardMsg) |
| 1459 | raise self.failureException(msg) |
| 1460 | |
| 1461 | def _tail_type_check(self, s, tails, msg): |
| 1462 | if not isinstance(tails, tuple): |