summaryrefslogtreecommitdiff
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_logging.py')
-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 3765f36aa6..3fcc77acb4 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):