本文整理汇总了Python中asynctest.mock.Mock.id方法的典型用法代码示例。如果您正苦于以下问题:Python Mock.id方法的具体用法?Python Mock.id怎么用?Python Mock.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asynctest.mock.Mock
的用法示例。
在下文中一共展示了Mock.id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_cached_stranger__cached
# 需要导入模块: from asynctest.mock import Mock [as 别名]
# 或者: from asynctest.mock.Mock import id [as 别名]
def test_get_cached_stranger__cached(self):
cached_stranger = Mock()
cached_stranger.id = 31416
self.stranger_service._strangers_cache[31416] = cached_stranger
stranger = Mock()
stranger.id = 31416
self.assertEqual(self.stranger_service.get_cached_stranger(stranger), cached_stranger)
示例2: test_on_chat_message__text_stranger_has_blocked_the_bot
# 需要导入模块: from asynctest.mock import Mock [as 别名]
# 或者: from asynctest.mock.Mock import id [as 别名]
async def test_on_chat_message__text_stranger_has_blocked_the_bot(self, handle_command_mock):
from randtalkbot.stranger_handler import LOGGER
from randtalkbot.stranger_handler import Message
from randtalkbot.stranger_handler import telepot
from randtalkbot.stranger_handler import StrangerError
telepot.glance.return_value = 'text', 'private', 31416
self.stranger_setup_wizard.handle.return_value = False
message_json = {
'text': 'message_text',
}
Message.return_value.command = None
partner = Mock()
partner.id = 27183
self.stranger.get_partner = Mock(return_value=partner)
self.stranger.id = 31416
self.stranger.send_to_partner = CoroutineMock(side_effect=TelegramError({}, '', 0))
await self.stranger_handler.on_chat_message(message_json)
LOGGER.warning(
'Send text. Can\'t send to partned: %d -> %d',
31416,
27183
)
self.sender.send_notification.assert_called_once_with(
'Your partner has blocked me! How did you do that?!',
)