mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
Fix for a bug in the short timeElapsed.
This commit is contained in:
parent
f1cbd065f3
commit
5466544350
@ -127,10 +127,10 @@ def timeElapsed(elapsed, short=False, leadingZeroes=False, years=True,
|
||||
"""
|
||||
ret = []
|
||||
def format(s, i):
|
||||
if short:
|
||||
ret.append('%s%s' % (i, s[0]))
|
||||
else:
|
||||
if leadingZeroes or ret or i:
|
||||
if i or leadingZeroes or ret:
|
||||
if short:
|
||||
ret.append('%s%s' % (i, s[0]))
|
||||
else:
|
||||
ret.append(nItems(s, i))
|
||||
elapsed = int(elapsed)
|
||||
assert years or weeks or days or \
|
||||
|
@ -98,6 +98,9 @@ class UtilsTest(SupyTestCase):
|
||||
'and 2 seconds')]:
|
||||
self.assertEqual(utils.timeElapsed(now - then), expected)
|
||||
|
||||
def timeElapsedShort(self):
|
||||
self.assertEqual(utils.timeElapsed(123, short=True), '2m 3s')
|
||||
|
||||
def testEachSubstring(self):
|
||||
s = 'foobar'
|
||||
L = ['f', 'fo', 'foo', 'foob', 'fooba', 'foobar']
|
||||
|
Loading…
Reference in New Issue
Block a user