mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-05 17:52:39 +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), \
|
assert isinstance(n, int), \
|
||||||
'The order of the arguments to nItems changed again, sorry.'
|
'The order of the arguments to nItems changed again, sorry.'
|
||||||
if between is None:
|
if between is None:
|
||||||
if n > 1:
|
if n != 1:
|
||||||
return format('%s %p', n, item)
|
return format('%s %p', n, item)
|
||||||
else:
|
else:
|
||||||
return format('%s %s', n, item)
|
return format('%s %s', n, item)
|
||||||
else:
|
else:
|
||||||
if n > 1:
|
if n != 1:
|
||||||
return format('%s %s %p', n, between, item)
|
return format('%s %s %p', n, between, item)
|
||||||
else:
|
else:
|
||||||
return format('%s %s %s', n, between, item)
|
return format('%s %s %s', n, between, item)
|
||||||
|
@ -328,6 +328,7 @@ class StrTest(SupyTestCase):
|
|||||||
|
|
||||||
def testNItems(self):
|
def testNItems(self):
|
||||||
nItems = utils.str.nItems
|
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', 'crazy'), '1 crazy tool')
|
||||||
self.assertEqual(nItems(1, 'tool'), '1 tool')
|
self.assertEqual(nItems(1, 'tool'), '1 tool')
|
||||||
self.assertEqual(nItems(2, 'tool', 'crazy'), '2 crazy tools')
|
self.assertEqual(nItems(2, 'tool', 'crazy'), '2 crazy tools')
|
||||||
|
Loading…
Reference in New Issue
Block a user