Skip to content

Commit

Permalink
Add more uses of @OverRide.
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Kaseorg <anders@zulip.com>
  • Loading branch information
andersk committed Nov 13, 2023
1 parent f78e6e6 commit f11e960
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions zulip_bots/zulip_bots/bots/beeminder/test_beeminder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import patch

from requests.exceptions import ConnectionError
from typing_extensions import override

from zulip_bots.test_file_utils import get_bot_message_handler
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler
Expand All @@ -21,6 +22,7 @@ class TestBeeminderBot(BotTestCase, DefaultTests):
\n* `comment`**:** Add a comment [**NOTE:** Optional field, default is *None*]\
"""

@override
def test_bot_responds_to_empty_message(self) -> None:
with self.mock_config_info(self.normal_config), self.mock_http_conversation(
"test_valid_auth_token"
Expand Down
2 changes: 2 additions & 0 deletions zulip_bots/zulip_bots/bots/flock/test_flock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import patch

from requests.exceptions import ConnectionError
from typing_extensions import override

from zulip_bots.test_lib import BotTestCase, DefaultTests

Expand All @@ -17,6 +18,7 @@ class TestFlockBot(BotTestCase, DefaultTests):
*Syntax*: **@botname to: message** where `to` is **firstName** of recipient.
"""

@override
def test_bot_responds_to_empty_message(self) -> None:
self.verify_reply("", self.help_message)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Dict, Final, List, Tuple

from typing_extensions import override

from zulip_bots.bots.game_of_fifteen.game_of_fifteen import GameOfFifteenModel
from zulip_bots.game_handler import BadMoveError
from zulip_bots.test_lib import BotTestCase, DefaultTests
Expand All @@ -8,6 +10,7 @@
class TestGameOfFifteenBot(BotTestCase, DefaultTests):
bot_name = "game_of_fifteen"

@override
def make_request_message(
self, content: str, user: str = "foo@example.com", user_name: str = "foo"
) -> Dict[str, str]:
Expand Down
4 changes: 3 additions & 1 deletion zulip_bots/zulip_bots/bots/jira/test_jira.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Final

from typing_extensions import override

from zulip_bots.test_lib import BotTestCase, DefaultTests


Expand Down Expand Up @@ -260,7 +262,7 @@ def test_help(self) -> None:
with self.mock_config_info(self.MOCK_CONFIG_INFO):
self.verify_reply("help", self.MOCK_HELP_RESPONSE)

# This overrides the default one in `BotTestCase`.
@override
def test_bot_responds_to_empty_message(self) -> None:
with self.mock_config_info(self.MOCK_CONFIG_INFO):
self.verify_reply("", self.MOCK_NOTHING_RESPONSE)
Expand Down
3 changes: 3 additions & 0 deletions zulip_bots/zulip_bots/bots/merels/merels.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Any, Final, List

from typing_extensions import override

from zulip_bots.game_handler import GameAdapter, SamePlayerMoveError

from .libraries import database, game, game_data, mechanics
Expand Down Expand Up @@ -76,6 +78,7 @@ class MerelsHandler(GameAdapter):
"description": "Lets you play merels against any player.",
}

@override
def usage(self) -> str:
return game.get_info()

Expand Down
4 changes: 4 additions & 0 deletions zulip_bots/zulip_bots/bots/twitpost/test_twitpost.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import Final
from unittest.mock import patch

from typing_extensions import override

from zulip_bots.test_file_utils import get_bot_message_handler, read_bot_fixture_data
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler

Expand All @@ -15,6 +17,7 @@ class TestTwitpostBot(BotTestCase, DefaultTests):
}
api_response = read_bot_fixture_data("twitpost", "api_response")

@override
def test_bot_usage(self) -> None:
bot = get_bot_message_handler(self.bot_name)
bot_handler = StubBotHandler()
Expand All @@ -24,6 +27,7 @@ def test_bot_usage(self) -> None:

self.assertIn("This bot posts on twitter from zulip chat itself", bot.usage())

@override
def test_bot_responds_to_empty_message(self) -> None:
with self.mock_config_info(self.mock_config):
self.verify_reply("", "Please check help for usage.")
Expand Down

0 comments on commit f11e960

Please sign in to comment.