mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
commaAndified timeElapsed.
This commit is contained in:
parent
526e5b613b
commit
6bfd991947
@ -164,7 +164,7 @@ def timeElapsed(elapsed, leadingZeroes=False, years=True, weeks=True,
|
||||
if len(ret) == 1:
|
||||
return ret[0]
|
||||
else:
|
||||
return ' and '.join([', '.join(ret[:-1]), ret[-1]])
|
||||
return commaAndify(ret)
|
||||
|
||||
def distance(s, t):
|
||||
"""Returns the levenshtein edit distance between two strings."""
|
||||
|
@ -45,8 +45,8 @@ class UtilsTest(unittest.TestCase):
|
||||
(61, '1 minute and 1 second'),
|
||||
(62, '1 minute and 2 seconds'),
|
||||
(122, '2 minutes and 2 seconds'),
|
||||
(3722, '1 hour, 2 minutes and 2 seconds'),
|
||||
(7322, '2 hours, 2 minutes and 2 seconds')]:
|
||||
(3722, '1 hour, 2 minutes, and 2 seconds'),
|
||||
(7322, '2 hours, 2 minutes, and 2 seconds')]:
|
||||
self.assertEqual(utils.timeElapsed(now - then), expected)
|
||||
|
||||
def testEachSubstring(self):
|
||||
|
Loading…
Reference in New Issue
Block a user