diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2014-01-13 21:59:56 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2014-01-13 21:59:56 (GMT) |
commit | 1fd1202072e198a7b3cf1254787aff3e3bf1c99e (patch) | |
tree | 4012319a4d96feaad50150a0bde90da1d6989f8e /Lib/test | |
parent | 66c9350a8932d41f2c34c0e8a511c20f4d7acb3e (diff) | |
download | cpython-1fd1202072e198a7b3cf1254787aff3e3bf1c99e.zip cpython-1fd1202072e198a7b3cf1254787aff3e3bf1c99e.tar.gz cpython-1fd1202072e198a7b3cf1254787aff3e3bf1c99e.tar.bz2 |
Issue #20242: Fixed basicConfig() format strings for the alternative formatting styles.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_logging.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 8c6e6b8..814f68c 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3337,6 +3337,22 @@ class BasicConfigTest(unittest.TestCase): # level is not explicitly set self.assertEqual(logging.root.level, self.original_logging_level) + def test_strformatstyle(self): + with captured_stdout() as output: + logging.basicConfig(stream=sys.stdout, style="{") + logging.error("Log an error") + sys.stdout.seek(0) + self.assertEqual(output.getvalue().strip(), + "ERROR:root:Log an error") + + def test_stringtemplatestyle(self): + with captured_stdout() as output: + logging.basicConfig(stream=sys.stdout, style="$") + logging.error("Log an error") + sys.stdout.seek(0) + self.assertEqual(output.getvalue().strip(), + "ERROR:root:Log an error") + def test_filename(self): logging.basicConfig(filename='test.log') |