diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2021-06-03 08:12:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 08:12:59 (GMT) |
commit | 8b93f0e696d3fc60fd311c13d5238da73a35e3b3 (patch) | |
tree | 0d1b5fd01fe4c7ab9ee1c38b801274a085bd7c4a /Lib/test/test_logging.py | |
parent | 4846ea95d1a121df5e8081e2a290f63d1419cad8 (diff) | |
download | cpython-8b93f0e696d3fc60fd311c13d5238da73a35e3b3.zip cpython-8b93f0e696d3fc60fd311c13d5238da73a35e3b3.tar.gz cpython-8b93f0e696d3fc60fd311c13d5238da73a35e3b3.tar.bz2 |
bpo-43858: Add logging.getLevelNamesMapping() (GH-26459)
Added a function that returns a copy of a dict of logging levels.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r-- | Lib/test/test_logging.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index ee00a32..6d11190 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -4390,6 +4390,14 @@ class ModuleLevelMiscTest(BaseTest): self.assertNotIn("Cannot recover from stack overflow.", err) self.assertEqual(rc, 1) + def test_get_level_names_mapping(self): + mapping = logging.getLevelNamesMapping() + self.assertEqual(logging._nameToLevel, mapping) # value is equivalent + self.assertIsNot(logging._nameToLevel, mapping) # but not the internal data + new_mapping = logging.getLevelNamesMapping() # another call -> another copy + self.assertIsNot(mapping, new_mapping) # verify not the same object as before + self.assertEqual(mapping, new_mapping) # but equivalent in value + class LogRecordTest(BaseTest): def test_str_rep(self): |