]> granicus.if.org Git - python/commitdiff
Closes #20242: Merged fix from 3.3.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 13 Jan 2014 22:01:16 +0000 (22:01 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 13 Jan 2014 22:01:16 +0000 (22:01 +0000)
1  2 
Lib/logging/__init__.py
Lib/test/test_logging.py
Misc/NEWS

Simple merge
index 3765f36aa6d5c49d1ce6cf284786fd9730c4793d,814f68cc15452ce36086baf2f2ca95eecb9b3415..3fcc77acb4556597a4453b4a2e62206b52483c72
@@@ -3517,13 -3337,23 +3517,29 @@@ 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):
 +            h1.close()
 +            h2.close()
 +            os.remove(fn)
 +
          logging.basicConfig(filename='test.log')
  
          self.assertEqual(len(logging.root.handlers), 1)
diff --cc Misc/NEWS
Simple merge