mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Use 0 when no results are returned for Google.fight
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 3689460d0f
)
This commit is contained in:
parent
2a79c0cab9
commit
afb4e1e07f
@ -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