mirror of https://github.com/python/cpython
Yet more test_logging coverage improvements.
This commit is contained in:
parent
985ef87ea0
commit
373baef1eb
|
@ -2047,6 +2047,27 @@ class ConfigDictTest(BaseTest):
|
|||
# Original logger output is empty.
|
||||
self.assert_log_lines([])
|
||||
|
||||
def test_baseconfig(self):
|
||||
d = {
|
||||
'atuple': (1, 2, 3),
|
||||
'alist': ['a', 'b', 'c'],
|
||||
'adict': {'d': 'e', 'f': 3 },
|
||||
'nest1': ('g', ('h', 'i'), 'j'),
|
||||
'nest2': ['k', ['l', 'm'], 'n'],
|
||||
'nest3': ['o', 'cfg://alist', 'p'],
|
||||
}
|
||||
bc = logging.config.BaseConfigurator(d)
|
||||
self.assertEqual(bc.convert('cfg://atuple[1]'), 2)
|
||||
self.assertEqual(bc.convert('cfg://alist[1]'), 'b')
|
||||
self.assertEqual(bc.convert('cfg://nest1[1][0]'), 'h')
|
||||
self.assertEqual(bc.convert('cfg://nest2[1][1]'), 'm')
|
||||
self.assertEqual(bc.convert('cfg://adict.d'), 'e')
|
||||
self.assertEqual(bc.convert('cfg://adict[f]'), 3)
|
||||
v = bc.convert('cfg://nest3')
|
||||
self.assertEqual(v.pop(1), ['a', 'b', 'c'])
|
||||
self.assertRaises(KeyError, bc.convert, 'cfg://nosuch')
|
||||
self.assertRaises(ValueError, bc.convert, 'cfg://!')
|
||||
self.assertRaises(KeyError, bc.convert, 'cfg://adict[2]')
|
||||
|
||||
class ManagerTest(BaseTest):
|
||||
def test_manager_loggerclass(self):
|
||||
|
|
Loading…
Reference in New Issue