mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-26 17:14:42 +00:00
Fix strtime test.
This commit is contained in:
parent
2c252fd845
commit
b567f766ba
2 changed files with 5 additions and 5 deletions
|
|
@ -199,10 +199,9 @@ def strsize (b, grouping=True):
|
|||
return u"%sGB" % locale.format("%.1f", (float(b) / (1024*1024*1024)), grouping)
|
||||
|
||||
|
||||
def strtime (t):
|
||||
def strtime (t, func=time.localtime):
|
||||
"""Return ISO 8601 formatted time."""
|
||||
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(t)) + \
|
||||
strtimezone()
|
||||
return time.strftime("%Y-%m-%d %H:%M:%S", func(t)) + strtimezone()
|
||||
|
||||
|
||||
# from quodlibet
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ Test string formatting operations.
|
|||
|
||||
import unittest
|
||||
import os
|
||||
import time
|
||||
import linkcheck.strformat
|
||||
|
||||
|
||||
|
|
@ -120,8 +121,8 @@ class TestStrFormat (unittest.TestCase):
|
|||
|
||||
def test_strtime (self):
|
||||
zone = linkcheck.strformat.strtimezone()
|
||||
t = linkcheck.strformat.strtime(0)
|
||||
self.assertEqual(t, "1970-01-01 01:00:00"+zone)
|
||||
t = linkcheck.strformat.strtime(0, func=time.gmtime)
|
||||
self.assertEqual(t, "1970-01-01 00:00:00"+zone)
|
||||
|
||||
def test_duration (self):
|
||||
duration = linkcheck.strformat.strduration
|
||||
|
|
|
|||
Loading…
Reference in a new issue