Kaydet (Commit) 89807a52 authored tarafından Vinay Sajip's avatar Vinay Sajip

Issue #11330: Updated tests for correct asctime handling.

üst ed0473cf
......@@ -383,7 +383,7 @@ class StrFormatStyle(PercentStyle):
class StringTemplateStyle(PercentStyle):
default_format = '${message}'
asctime_format = '${asctime}'
asctime_search = '${asctime'
asctime_search = '${asctime}'
def __init__(self, fmt):
self._fmt = fmt or self.default_format
......
......@@ -1907,6 +1907,8 @@ class FormatterTest(unittest.TestCase):
self.assertFalse(f.usesTime())
f = logging.Formatter('%(asctime)s')
self.assertTrue(f.usesTime())
f = logging.Formatter('%(asctime)-15s')
self.assertTrue(f.usesTime())
f = logging.Formatter('asctime')
self.assertFalse(f.usesTime())
......@@ -1920,6 +1922,10 @@ class FormatterTest(unittest.TestCase):
self.assertFalse(f.usesTime())
f = logging.Formatter('{asctime}', style='{')
self.assertTrue(f.usesTime())
f = logging.Formatter('{asctime!s:15}', style='{')
self.assertTrue(f.usesTime())
f = logging.Formatter('{asctime:15}', style='{')
self.assertTrue(f.usesTime())
f = logging.Formatter('asctime', style='{')
self.assertFalse(f.usesTime())
......@@ -1935,6 +1941,8 @@ class FormatterTest(unittest.TestCase):
self.assertFalse(f.usesTime())
f = logging.Formatter('${asctime}', style='$')
self.assertTrue(f.usesTime())
f = logging.Formatter('${asctime', style='$')
self.assertFalse(f.usesTime())
f = logging.Formatter('$asctime', style='$')
self.assertTrue(f.usesTime())
f = logging.Formatter('asctime', style='$')
......@@ -2097,7 +2105,7 @@ def test_main():
LogRecordFactoryTest, ChildLoggerTest, QueueHandlerTest,
RotatingFileHandlerTest,
LastResortTest,
#TimedRotatingFileHandlerTest
TimedRotatingFileHandlerTest
)
if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment