コード例 #1
0
 def test_get_timestamp(self):
     for seps, pattern in [((), '^\d{8} \d\d:\d\d:\d\d.\d\d\d$'),
                           (('',' ',':',None), '^\d{8} \d\d:\d\d:\d\d$'),
                           (('','','',None), '^\d{14}$'),
                           (('-',' ',':',';'),
                            '^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d;\d\d\d$')]:
         ts = get_timestamp(*seps)
         assert_not_none(re.search(pattern, ts),
                         "'%s' didn't match '%s'" % (ts, pattern), False)
コード例 #2
0
 def test_get_timestamp(self):
     for seps, pattern in [((), '^\d{8} \d\d:\d\d:\d\d.\d\d\d$'),
                           (('',' ',':',None), '^\d{8} \d\d:\d\d:\d\d$'),
                           (('','','',None), '^\d{14}$'),
                           (('-',' ',':',';'),
                            '^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d;\d\d\d$')]:
         ts = get_timestamp(*seps)
         assert_not_none(re.search(pattern, ts),
                         "'%s' didn't match '%s'" % (ts, pattern), False)
コード例 #3
0
 def test_get_timestamp_without_millis(self):
     # Need to test twice to verify also possible cached timestamp
     assert_true(
         re.match('\d{8} \d\d:\d\d:\d\d', get_timestamp(millissep=None)))
     assert_true(
         re.match('\d{8} \d\d:\d\d:\d\d', get_timestamp(millissep=None)))
コード例 #4
0
 def test_get_timestamp_without_millis(self):
     # Need to test twice to verify also possible cached timestamp
     assert_true(re.match('\d{8} \d\d:\d\d:\d\d', get_timestamp(millissep=None)))
     assert_true(re.match('\d{8} \d\d:\d\d:\d\d', get_timestamp(millissep=None)))