Python 3.4+ is now required
parent
20cc193f46
commit
999297b316
|
@ -12,7 +12,7 @@ will need to be updated to run on Python3 if they do not already. All of the
|
||||||
core modules have been ported, removed, or replaced.
|
core modules have been ported, removed, or replaced.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
* Python 3.2+
|
* Python 3.4+
|
||||||
* [python-requests](http://docs.python-requests.org/en/latest/)
|
* [python-requests](http://docs.python-requests.org/en/latest/)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
|
@ -184,16 +184,5 @@ def search(phenny, input):
|
||||||
phenny.reply(result)
|
phenny.reply(result)
|
||||||
search.commands = ['search']
|
search.commands = ['search']
|
||||||
|
|
||||||
def suggest(phenny, input):
|
|
||||||
if not input.group(2):
|
|
||||||
return phenny.reply("No query term.")
|
|
||||||
query = input.group(2)
|
|
||||||
uri = 'http://websitedev.de/temp-bin/suggest.pl?q='
|
|
||||||
answer = web.get(uri + web.quote(query).replace('+', '%2B'))
|
|
||||||
if answer:
|
|
||||||
phenny.say(answer)
|
|
||||||
else: phenny.reply('Sorry, no result.')
|
|
||||||
suggest.commands = ['suggest']
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(__doc__.strip())
|
print(__doc__.strip())
|
||||||
|
|
|
@ -8,7 +8,7 @@ import unittest
|
||||||
from mock import MagicMock, Mock
|
from mock import MagicMock, Mock
|
||||||
from modules.search import duck_api, google_search, google_count, \
|
from modules.search import duck_api, google_search, google_count, \
|
||||||
formatnumber, g, gc, gcs, bing_search, bing, duck_search, duck, \
|
formatnumber, g, gc, gcs, bing_search, bing, duck_search, duck, \
|
||||||
search, suggest
|
search
|
||||||
|
|
||||||
|
|
||||||
class TestSearch(unittest.TestCase):
|
class TestSearch(unittest.TestCase):
|
||||||
|
@ -75,10 +75,3 @@ class TestSearch(unittest.TestCase):
|
||||||
duck(self.phenny, input)
|
duck(self.phenny, input)
|
||||||
|
|
||||||
assert self.phenny.reply.called is True
|
assert self.phenny.reply.called is True
|
||||||
|
|
||||||
def test_suggest(self):
|
|
||||||
input = Mock(group=lambda x: 'vtluug')
|
|
||||||
suggest(self.phenny, input)
|
|
||||||
|
|
||||||
assert (self.phenny.reply.called is True or \
|
|
||||||
self.phenny.say.called is True)
|
|
||||||
|
|
Loading…
Reference in New Issue