kill .py
parent
9f11190f0b
commit
78441d5fbf
|
@ -52,15 +52,6 @@ def c(phenny, input):
|
||||||
c.commands = ['c']
|
c.commands = ['c']
|
||||||
c.example = '.c 5 + 3'
|
c.example = '.c 5 + 3'
|
||||||
|
|
||||||
def py(phenny, input):
|
|
||||||
query = input.group(2) or ""
|
|
||||||
uri = 'http://tumbolia.appspot.com/py/'
|
|
||||||
answer = web.get(uri + web.quote(query))
|
|
||||||
if answer:
|
|
||||||
phenny.say(answer)
|
|
||||||
else: phenny.reply('Sorry, no result.')
|
|
||||||
py.commands = ['py']
|
|
||||||
|
|
||||||
def wa(phenny, input):
|
def wa(phenny, input):
|
||||||
if not input.group(2):
|
if not input.group(2):
|
||||||
return phenny.reply("No search term.")
|
return phenny.reply("No search term.")
|
||||||
|
|
|
@ -5,7 +5,7 @@ author: mutantmonkey <mutantmonkey@mutantmonkey.in>
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from mock import MagicMock, Mock
|
from mock import MagicMock, Mock
|
||||||
from modules.calc import c, py, wa
|
from modules.calc import c, wa
|
||||||
|
|
||||||
|
|
||||||
class TestCalc(unittest.TestCase):
|
class TestCalc(unittest.TestCase):
|
||||||
|
@ -30,16 +30,6 @@ class TestCalc(unittest.TestCase):
|
||||||
|
|
||||||
self.phenny.reply.assert_called_once_with('Sorry, no result.')
|
self.phenny.reply.assert_called_once_with('Sorry, no result.')
|
||||||
|
|
||||||
def test_py(self):
|
|
||||||
input = Mock(group=lambda x: "'test'*3")
|
|
||||||
py(self.phenny, input)
|
|
||||||
|
|
||||||
self.phenny.say.assert_called_once_with('testtesttest\n')
|
|
||||||
|
|
||||||
def test_py_none(self):
|
|
||||||
input = Mock(group=lambda x: "")
|
|
||||||
py(self.phenny, input)
|
|
||||||
|
|
||||||
def test_wa(self):
|
def test_wa(self):
|
||||||
input = Mock(group=lambda x: 'airspeed of an unladen swallow')
|
input = Mock(group=lambda x: 'airspeed of an unladen swallow')
|
||||||
wa(self.phenny, input)
|
wa(self.phenny, input)
|
||||||
|
|
Loading…
Reference in New Issue