mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-31 23:32:35 +01:00
Fixed a bug that was introduced in nItems.
This commit is contained in:
parent
2840aeda1e
commit
2b6994428e
@ -299,12 +299,12 @@ def nItems(n, item, between=None):
|
||||
assert isinstance(n, int), \
|
||||
'The order of the arguments to nItems changed again, sorry.'
|
||||
if between is None:
|
||||
if n > 1:
|
||||
if n != 1:
|
||||
return format('%s %p', n, item)
|
||||
else:
|
||||
return format('%s %s', n, item)
|
||||
else:
|
||||
if n > 1:
|
||||
if n != 1:
|
||||
return format('%s %s %p', n, between, item)
|
||||
else:
|
||||
return format('%s %s %s', n, between, item)
|
||||
|
@ -328,6 +328,7 @@ class StrTest(SupyTestCase):
|
||||
|
||||
def testNItems(self):
|
||||
nItems = utils.str.nItems
|
||||
self.assertEqual(nItems(0, 'tool'), '0 tools')
|
||||
self.assertEqual(nItems(1, 'tool', 'crazy'), '1 crazy tool')
|
||||
self.assertEqual(nItems(1, 'tool'), '1 tool')
|
||||
self.assertEqual(nItems(2, 'tool', 'crazy'), '2 crazy tools')
|
||||
|
Loading…
Reference in New Issue
Block a user