summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2014-01-13 21:59:56 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2014-01-13 21:59:56 (GMT)
commit1fd1202072e198a7b3cf1254787aff3e3bf1c99e (patch)
tree4012319a4d96feaad50150a0bde90da1d6989f8e /Lib/test
parent66c9350a8932d41f2c34c0e8a511c20f4d7acb3e (diff)
downloadcpython-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.py16
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')