mypy: Annotate helloworld bot.
This commit is contained in:
parent
69ad29faad
commit
8cd310493a
|
@ -1,8 +1,9 @@
|
||||||
# See readme.md for instructions on running this code.
|
# See readme.md for instructions on running this code.
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
class HelloWorldHandler(object):
|
class HelloWorldHandler(object):
|
||||||
def usage(self):
|
def usage(self) -> str:
|
||||||
return '''
|
return '''
|
||||||
This is a boilerplate bot that responds to a user query with
|
This is a boilerplate bot that responds to a user query with
|
||||||
"beep boop", which is robot for "Hello World".
|
"beep boop", which is robot for "Hello World".
|
||||||
|
@ -11,8 +12,8 @@ class HelloWorldHandler(object):
|
||||||
sophisticated, bots.
|
sophisticated, bots.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def handle_message(self, message, bot_handler):
|
def handle_message(self, message: Any, bot_handler: Any) -> None:
|
||||||
content = 'beep boop'
|
content = 'beep boop' # type: str
|
||||||
bot_handler.send_reply(message, content)
|
bot_handler.send_reply(message, content)
|
||||||
|
|
||||||
handler_class = HelloWorldHandler
|
handler_class = HelloWorldHandler
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
from zulip_bots.test_lib import StubBotTestCase
|
from zulip_bots.test_lib import StubBotTestCase
|
||||||
|
|
||||||
class TestHelpBot(StubBotTestCase):
|
class TestHelpBot(StubBotTestCase):
|
||||||
bot_name = "helloworld"
|
bot_name = "helloworld" # type: str
|
||||||
|
|
||||||
def test_bot(self):
|
def test_bot(self) -> None:
|
||||||
dialog = [
|
dialog = [
|
||||||
('', 'beep boop'),
|
('', 'beep boop'),
|
||||||
('help', 'beep boop'),
|
('help', 'beep boop'),
|
||||||
|
|
Loading…
Reference in a new issue