diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2014-01-13 22:01:16 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2014-01-13 22:01:16 +0000 |
commit | 30e6a64e7675b16c5ba501d98de4702c468b134d (patch) | |
tree | 3c4d3b38e2782314f0459168fa1457a501b26836 /Lib/test/test_logging.py | |
parent | 936dfae2e22b5b58d01416ddf47218c20bfde5e6 (diff) | |
parent | 1fd1202072e198a7b3cf1254787aff3e3bf1c99e (diff) | |
download | cpython-30e6a64e7675b16c5ba501d98de4702c468b134d.tar.gz cpython-30e6a64e7675b16c5ba501d98de4702c468b134d.zip |
Closes #20242: Merged fix from 3.3.
Diffstat (limited to 'Lib/test/test_logging.py')
-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 3765f36aa6d..3fcc77acb45 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3517,6 +3517,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): def cleanup(h1, h2, fn): |