Fixed bug in genre pluralization.

This commit is contained in:
Jeremy Fincher 2003-09-22 17:32:12 +00:00
parent 644eb1c248
commit 3e28059c9e
2 changed files with 10 additions and 4 deletions

View File

@ -68,10 +68,12 @@ class IMDB(callbacks.Privmsg):
def _formatMovie(self, movie):
title = utils.unCommaThe(movie.title())
genres = utils.commaAndify(map(str.lower, movie.genres()))
s = '"%s" (%s) belongs to the %s genres. ' \
s = '"%s" (%s) belongs to the %s %s. ' \
'It\'s been rated %s out of 10. ' \
'More information is available at <%s>' % \
(title, movie.year(), genres, movie.rating(), movie.url)
(title, movie.year(), genres,
utils.pluralize(len(movie.genres()), 'genre'),
movie.rating(), movie.url)
return s
def imdb(self, irc, msg, args):

View File

@ -35,8 +35,12 @@ class IMDBTestCase(PluginTestCase, PluginDocumentation):
plugins = ('IMDB',)
def testImdb(self):
self.assertNotError('imdb die hard')
m = self.getMsg('imdb kevin spacey')
self.failUnless('is apparently a person' in m.args[1])
self.assertRegexp('imdb kevin spacey', 'is apparently a person')
def testGenrePluralization(self):
self.assertNotRegexp('imdb 24', 'genres')
self.assertRegexp('imdb die hard', 'genres')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: