mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Use 0 when no results are returned for Google.fight
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
a48cd109a3
commit
3689460d0f
@ -219,7 +219,8 @@ class Google(callbacks.PluginRegexp):
|
||||
results = []
|
||||
for arg in args:
|
||||
data = self.search(arg, channel, {'smallsearch': True})
|
||||
count = data['responseData']['cursor']['estimatedResultCount']
|
||||
count = data['responseData']['cursor'].get('estimatedResultCount',
|
||||
0)
|
||||
results.append((int(count), arg))
|
||||
results.sort()
|
||||
results.reverse()
|
||||
|
@ -1,6 +1,6 @@
|
||||
###
|
||||
# Copyright (c) 2002-2004, Jeremiah Fincher
|
||||
# Copyright (c) 2008, James Vega
|
||||
# Copyright (c) 2008-2009, James Vega
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -55,6 +55,7 @@ class GoogleTestCase(ChannelPluginTestCase):
|
||||
|
||||
def testFight(self):
|
||||
self.assertRegexp('fight supybot moobot', r'.*supybot.*: \d+')
|
||||
self.assertNotError('fight ... !')
|
||||
|
||||
def testTranslate(self):
|
||||
self.assertRegexp('translate en es hello world', 'mundo')
|
||||
|
Loading…
Reference in New Issue
Block a user