pydle/tests/test_ircv3.py

37 lines
1.2 KiB
Python
Raw Normal View History

import pytest
from pydle.features import ircv3
2020-10-13 20:40:34 +00:00
pytestmark = [pytest.mark.unit, pytest.mark.ircv3]
@pytest.mark.parametrize(
"payload, expected",
[
(
rb'@empty=;missing :irc.example.com NOTICE #channel :Message',
{'empty': True, 'missing': True}
),
(
rb"@+example=raw+:=,escaped\:\s\\ :irc.example.com NOTICE #channel :Message",
{"+example": """raw+:=,escaped; \\"""}
),
(
2019-12-23 00:21:52 +00:00
rb"@+example=\foo\bar :irc.example.com NOTICE #channel :Message",
{"+example": "foobar"}
),
2020-10-13 20:40:34 +00:00
(
rb'@msgid=796~1602221579~51;account=user123 :user123!user123@(ip) PRIVMSG #user123 :ping',
2020-10-13 20:40:34 +00:00
{'msgid': '796~1602221579~51', 'account': 'user123'}
),
(
rb'@inspircd.org/service;inspircd.org/bot :ChanServ!services@services.(domain) MODE #user123 +qo user123 :user123',
{"inspircd.org/service": True, r"inspircd.org/bot": True}
)
]
)
def test_tagged_message_escape_sequences(payload, expected):
message = ircv3.tags.TaggedMessage.parse(payload)
assert message.tags == expected