bpo-39385: Add an assertNoLogs context manager to unittest.TestCase (GH-18067)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index 52eb7d0..872f121 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -295,7 +295,6 @@
             self._raiseFailure("{} not triggered".format(exc_name))
 
 
-
 class _OrderedChainMap(collections.ChainMap):
     def __iter__(self):
         seen = set()
@@ -788,7 +787,16 @@
         """
         # Lazy import to avoid importing logging if it is not needed.
         from ._log import _AssertLogsContext
-        return _AssertLogsContext(self, logger, level)
+        return _AssertLogsContext(self, logger, level, no_logs=False)
+
+    def assertNoLogs(self, logger=None, level=None):
+        """ Fail unless no log messages of level *level* or higher are emitted
+        on *logger_name* or its children.
+
+        This method must be used as a context manager.
+        """
+        from ._log import _AssertLogsContext
+        return _AssertLogsContext(self, logger, level, no_logs=True)
 
     def _getAssertEqualityFunc(self, first, second):
         """Get a detailed comparison function for the types of the two args.