| 1393 | self.fail(self._formatMessage(msg, standardMsg)) |
| 1394 | |
| 1395 | def assertNotHasAttr(self, obj, name, msg=None): |
| 1396 | if hasattr(obj, name): |
| 1397 | if isinstance(obj, types.ModuleType): |
| 1398 | standardMsg = f'module {obj.__name__!r} has unexpected attribute {name!r}' |
| 1399 | elif isinstance(obj, type): |
| 1400 | standardMsg = f'type object {obj.__name__!r} has unexpected attribute {name!r}' |
| 1401 | else: |
| 1402 | standardMsg = f'{type(obj).__name__!r} object has unexpected attribute {name!r}' |
| 1403 | self.fail(self._formatMessage(msg, standardMsg)) |
| 1404 | |
| 1405 | def assertRaisesRegex(self, expected_exception, expected_regex, |
| 1406 | *args, **kwargs): |