fix wiktionary no results error handling
This commit is contained in:
@@ -20,6 +20,12 @@ class TestWiktionary(unittest.TestCase):
|
||||
assert len(w[0]) > 0
|
||||
assert len(w[1]) > 0
|
||||
|
||||
def test_wiktionary_none(self):
|
||||
w = wiktionary.wiktionary('Hell!')
|
||||
|
||||
assert len(w[0]) == 0
|
||||
assert len(w[1]) == 0
|
||||
|
||||
def test_w(self):
|
||||
input = Mock(group=lambda x: 'test')
|
||||
wiktionary.w(self.phenny, input)
|
||||
@@ -27,3 +33,11 @@ class TestWiktionary(unittest.TestCase):
|
||||
out = self.phenny.say.call_args[0][0]
|
||||
m = re.match('^test — noun: .*$', out, flags=re.UNICODE)
|
||||
self.assertTrue(m)
|
||||
|
||||
def test_w_none(self):
|
||||
word = 'Hell!'
|
||||
input = Mock(group=lambda x: word)
|
||||
wiktionary.w(self.phenny, input)
|
||||
|
||||
self.phenny.say.assert_called_once_with(
|
||||
"Couldn't get any definitions for {0}.".format(word))
|
||||
|
||||
Reference in New Issue
Block a user