| 347 | |
| 348 | |
| 349 | class _AssertNotWarnsContext(_AssertWarnsContext): |
| 350 | |
| 351 | def __exit__(self, exc_type, exc_value, tb): |
| 352 | self.warnings_manager.__exit__(exc_type, exc_value, tb) |
| 353 | if exc_type is not None: |
| 354 | # let unexpected exceptions pass through |
| 355 | return |
| 356 | try: |
| 357 | exc_name = self.expected.__name__ |
| 358 | except AttributeError: |
| 359 | exc_name = str(self.expected) |
| 360 | for m in self.warnings: |
| 361 | w = m.message |
| 362 | if isinstance(w, self.expected): |
| 363 | self._raiseFailure(f"{exc_name} triggered") |
| 364 | |
| 365 | |
| 366 | class _OrderedChainMap(collections.ChainMap): |