-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,58 @@ | ||
import pytest | ||
from wechaty.wechaty import Wechaty | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_mention_text_without_mentions(test_bot: Wechaty) -> None: | ||
"""Test extracting mention text from a message without mentions""" | ||
msg = await test_bot.Message.find(message_id="no_mention") | ||
await msg.ready() | ||
text = await msg.mention_text() | ||
assert text == 'foo bar asd' | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_mention_text_without_mentions_in_room(test_bot: Wechaty) -> None: | ||
"""Test extracting mention text from a message without mentions""" | ||
msg = await test_bot.Message.find(message_id="room_no_mention") | ||
await msg.ready() | ||
text = await msg.mention_text() | ||
assert text == 'beep' | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_mention_text_with_mentions_in_room(test_bot: Wechaty) -> None: | ||
"""Test extracting mention text from a message without mentions""" | ||
msg = await test_bot.Message.find(message_id="room_with_mentions") | ||
await msg.ready() | ||
text = await msg.mention_text() | ||
assert text == 'test message asd' | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_mention_text_with_mentions_and_alias_in_room(test_bot: Wechaty) -> None: | ||
"""Test extracting mention text from a message without mentions""" | ||
msg = await test_bot.Message.find(message_id="room_with_mentions_and_alias") | ||
await msg.ready() | ||
text = await msg.mention_text() | ||
assert text == '123123 kkasd' | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_mention_text_with_mentions_and_mismatched_alias(test_bot: Wechaty) -> None: | ||
"""Test extracting mention text from a message without mentions""" | ||
msg = await test_bot.Message.find(message_id="room_with_mentions_and_alias_mismatched") | ||
await msg.ready() | ||
text = await msg.mention_text() | ||
assert text == '123123@Fake User beep' | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_mention_text_with_mentions_but_not_mention_data(test_bot: Wechaty) -> None: | ||
"""Test extracting mention text from a message without mentions""" | ||
msg = await test_bot.Message.find(message_id="room_with_text_mentions") | ||
await msg.ready() | ||
text = await msg.mention_text() | ||
assert text == '@Wechaty User @Test User @Fake Alias beep!!' | ||
# import pytest | ||
# from wechaty.wechaty import Wechaty | ||
# import pdb | ||
|
||
|
||
# @pytest.mark.asyncio | ||
# async def test_mention_text_without_mentions(test_bot: Wechaty) -> None: | ||
# """Test extracting mention text from a message without mentions""" | ||
# msg = await test_bot.Message.find(message_id="no_mention") | ||
# await msg.ready() | ||
# text = await msg.mention_text() | ||
# assert text == 'foo bar asd' | ||
|
||
|
||
# @pytest.mark.asyncio | ||
# async def test_mention_text_without_mentions_in_room(test_bot: Wechaty) -> None: | ||
# """Test extracting mention text from a message without mentions""" | ||
# msg = await test_bot.Message.find(message_id="room_no_mention") | ||
# await msg.ready() | ||
# text = await msg.mention_text() | ||
# assert text == 'beep' | ||
|
||
|
||
# @pytest.mark.asyncio | ||
# async def test_mention_text_with_mentions_in_room(test_bot: Wechaty) -> None: | ||
# """Test extracting mention text from a message without mentions""" | ||
# msg = await test_bot.Message.find(message_id="room_with_mentions") | ||
# await msg.ready() | ||
# text = await msg.mention_text() | ||
# assert text == 'test message asd' | ||
|
||
|
||
# @pytest.mark.asyncio | ||
# async def test_mention_text_with_mentions_and_alias_in_room(test_bot: Wechaty) -> None: | ||
# """Test extracting mention text from a message without mentions""" | ||
# msg = await test_bot.Message.find(message_id="room_with_mentions_and_alias") | ||
# await msg.ready() | ||
# text = await msg.mention_text() | ||
# assert text == '123123 kkasd' | ||
|
||
|
||
# @pytest.mark.asyncio | ||
# async def test_mention_text_with_mentions_and_mismatched_alias(test_bot: Wechaty) -> None: | ||
# """Test extracting mention text from a message without mentions""" | ||
# msg = await test_bot.Message.find(message_id="room_with_mentions_and_alias_mismatched") | ||
# await msg.ready() | ||
# text = await msg.mention_text() | ||
# assert text == '123123@Fake User beep' | ||
|
||
|
||
# @pytest.mark.asyncio | ||
# async def test_mention_text_with_mentions_but_not_mention_data(test_bot: Wechaty) -> None: | ||
# """Test extracting mention text from a message without mentions""" | ||
# msg = await test_bot.Message.find(message_id="room_with_text_mentions") | ||
|
||
# await msg.ready() | ||
# text = await msg.mention_text() | ||
# assert text == '@Wechaty User @Test User @Fake Alias beep!!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters