mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 20:52:42 +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:
|
if len(ret) == 1:
|
||||||
return ret[0]
|
return ret[0]
|
||||||
else:
|
else:
|
||||||
return ' and '.join([', '.join(ret[:-1]), ret[-1]])
|
return commaAndify(ret)
|
||||||
|
|
||||||
def distance(s, t):
|
def distance(s, t):
|
||||||
"""Returns the levenshtein edit distance between two strings."""
|
"""Returns the levenshtein edit distance between two strings."""
|
||||||
|
@ -45,8 +45,8 @@ class UtilsTest(unittest.TestCase):
|
|||||||
(61, '1 minute and 1 second'),
|
(61, '1 minute and 1 second'),
|
||||||
(62, '1 minute and 2 seconds'),
|
(62, '1 minute and 2 seconds'),
|
||||||
(122, '2 minutes and 2 seconds'),
|
(122, '2 minutes and 2 seconds'),
|
||||||
(3722, '1 hour, 2 minutes and 2 seconds'),
|
(3722, '1 hour, 2 minutes, and 2 seconds'),
|
||||||
(7322, '2 hours, 2 minutes and 2 seconds')]:
|
(7322, '2 hours, 2 minutes, and 2 seconds')]:
|
||||||
self.assertEqual(utils.timeElapsed(now - then), expected)
|
self.assertEqual(utils.timeElapsed(now - then), expected)
|
||||||
|
|
||||||
def testEachSubstring(self):
|
def testEachSubstring(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user