Changed karma pluralization to use utils.pluralize() and fixed the tests to

avoid erroring due to ambiguous commands for 'stats' (since 'User' is also
loaded for the tests)
This commit is contained in:
Daniel DiPaolo 2003-10-29 07:46:49 +00:00
parent 0400f02f13
commit bfdbda625a
2 changed files with 7 additions and 7 deletions

View File

@ -370,8 +370,8 @@ class ChannelDB(plugins.ChannelDBHandler, callbacks.PrivmsgCommandAndRegexp):
total = added - subtracted
s = 'Karma for %r has been increased %s %s ' \
'and decreased %s %s for a total karma of %s.' % \
(name, added, added == 1 and 'time' or 'times',
subtracted, subtracted == 1 and 'time' or 'times', total)
(name, added, utils.pluralize(added, 'time'),
subtracted, utils.pluralize(subtracted, 'time'), total)
irc.reply(msg, s)
elif len(args) > 1:
criteria = ' OR '.join(['name=%s'] * len(args))

View File

@ -54,11 +54,11 @@ if sqlite is not None:
self.assertNotError('channelstats')
def testStats(self):
self.assertError('stats %s' % self.nick)
self.assertNotError('stats %s' % self.nick)
self.assertNotError('stats %s' % self.nick.upper())
self.assertNotError('stats')
self.assertRegexp('stats', self.nick)
self.assertError('channeldb stats %s' % self.nick)
self.assertNotError('channeldb stats %s' % self.nick)
self.assertNotError('channeldb stats %s' % self.nick.upper())
self.assertNotError('channeldb stats')
self.assertRegexp('channeldb stats', self.nick)
def testNoKeyErrorEscapeFromSeen(self):
self.assertRegexp('seen asldfkjasdlfkj', 'I have not seen')