xkcd tests: Use consistent imports.
MODIFY
zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py
zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py
-from unittest import mock
from unittest.mock import MagicMock, patch
from zulip_bots.test_lib import BotTestCase, DefaultTests
@@ -20,7 +19,7 @@ class TestXkcdBot(BotTestCase, DefaultTests):
with self.mock_http_conversation('test_random'):
# Mock randint function.
with patch('zulip_bots.bots.xkcd.xkcd.random.randint') as randint:
- mock_rand_value = mock.MagicMock()
+ mock_rand_value = MagicMock()
mock_rand_value.return_value = 1800
randint.return_value = mock_rand_value.return_value
self.verify_reply('random', bot_response)
@@ -31,8 +30,8 @@ class TestXkcdBot(BotTestCase, DefaultTests):
with self.mock_http_conversation('test_specific_id'):
self.verify_reply('1', bot_response)
- @mock.patch('logging.exception')
- def test_invalid_comic_ids(self, mock_logging_exception: mock.Mock) -> None:
+ @patch('logging.exception')
+ def test_invalid_comic_ids(self, mock_logging_exception: MagicMock) -> None:
invalid_id_txt = "Sorry, there is likely no xkcd comic strip with id: #"
for comic_id, fixture in (('0', 'test_not_existing_id_2'),

xkcd tests: Use consistent imports.