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