# Path: tests/conftest.py
# def wait_for_message(chats=None, msg_types=None, except_self=True, timeout=30):
#     """
#     等待一条指定的消息，并返回这条消息
# 
#     :param chats: 所需等待消息所在的聊天会话
#     :param msg_types: 所需等待的消息类型
#     :param except_self: 是否排除自己发送的消息
#     :param timeout: 等待的超时秒数，若为 None 则一直等待，直到收到所需的消息
#     :return: 若在超时内等到了消息，则返回此消息，否则抛出 `queue.Empty` 异常
#     """
# 
#     received = Queue()
# 
#     @_bot.register(chats=chats, msg_types=msg_types, except_self=except_self)
#     def _func(msg):
#         received.put(msg)
# 
#     _config = _bot.registered.get_config_by_func(_func)
# 
#     ret = received.get(timeout=timeout)
# 
#     _bot.registered.remove(_config)
# 
#     return ret


from datetime import datetime
from tests.conftest import wait_for_message
from wxpy import *
        assert sent.path == video_path

    def test_raw_message(self, group):
        # 发送名片
        raw_type = 42
        raw_content = '<msg username="{}" nickname="{}"/>'.format('wxpy_bot', 'wxpy 机器人')
        sent_message(group.send_raw_msg(raw_type, raw_content), None, group)

    def test_send(self, friend, file_path, image_path, video_path):
        text_to_send = 'test sending text'
        sent = friend.send(text_to_send)
        sent_message(sent, TEXT, friend)
        assert sent.text == text_to_send

        sent = friend.send('@fil@{}'.format(file_path))
        sent_message(sent, ATTACHMENT, friend)
        assert sent.path == file_path

        sent = friend.send('@img@{}'.format(image_path))
        sent_message(sent, PICTURE, friend)
        assert sent.path == image_path

        sent = friend.send('@vid@{}'.format(video_path))
        sent_message(sent, VIDEO, friend)
        assert sent.path == video_path

        # 发送名片
        raw_type = 42
        raw_content = '<msg username="{}" nickname="{}"/>'.format('wxpy_bot', 'wxpy 机器人')
        uri = '/webwxsendmsg'

# Path: tests/conftest.py
# def wait_for_message(chats=None, msg_types=None, except_self=True, timeout=30):
#     """
#     等待一条指定的消息，并返回这条消息
# 
#     :param chats: 所需等待消息所在的聊天会话
#     :param msg_types: 所需等待的消息类型
#     :param except_self: 是否排除自己发送的消息
#     :param timeout: 等待的超时秒数，若为 None 则一直等待，直到收到所需的消息
#     :return: 若在超时内等到了消息，则返回此消息，否则抛出 `queue.Empty` 异常
#     """
# 
#     received = Queue()
# 
#     @_bot.register(chats=chats, msg_types=msg_types, except_self=except_self)
#     def _func(msg):
#         received.put(msg)
# 
#     _config = _bot.registered.get_config_by_func(_func)
# 
#     ret = received.get(timeout=timeout)
# 
#     _bot.registered.remove(_config)
# 
#     return ret


# Path: tests/api/messages/test_message.py
from datetime import datetime
from tests.conftest import wait_for_message
from wxpy import *

        assert sent.path == video_path

    def test_raw_message(self, group):
        # 发送名片
        raw_type = 42
        raw_content = '<msg username="{}" nickname="{}"/>'.format('wxpy_bot', 'wxpy 机器人')
        sent_message(group.send_raw_msg(raw_type, raw_content), None, group)

    def test_send(self, friend, file_path, image_path, video_path):
        text_to_send = 'test sending text'
        sent = friend.send(text_to_send)
        sent_message(sent, TEXT, friend)
        assert sent.text == text_to_send

        sent = friend.send('@fil@{}'.format(file_path))
        sent_message(sent, ATTACHMENT, friend)
        assert sent.path == file_path

        sent = friend.send('@img@{}'.format(image_path))
        sent_message(sent, PICTURE, friend)
        assert sent.path == image_path

        sent = friend.send('@vid@{}'.format(video_path))
        sent_message(sent, VIDEO, friend)
        assert sent.path == video_path

        # 发送名片
        raw_type = 42
        raw_content = '<msg username="{}" nickname="{}"/>'.format('wxpy_bot', 'wxpy 机器人')
        uri = '/webwxsendmsg'

        sent = friend.send_raw_msg(raw_type, raw_content)