2019-12-23 00:19:02 +00:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from pydle.features import ircv3
|
|
|
|
|
2019-12-23 00:21:52 +00:00
|
|
|
pytestmark = pytest.mark.unit
|
2019-12-23 00:19:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"payload, expected",
|
|
|
|
[
|
|
|
|
(
|
|
|
|
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"}
|
2019-12-23 00:19:02 +00:00
|
|
|
),
|
|
|
|
]
|
|
|
|
)
|
|
|
|
def test_tagged_message_escape_sequences(payload, expected):
|
|
|
|
message = ircv3.tags.TaggedMessage.parse(payload)
|
|
|
|
|
|
|
|
assert message.tags == expected
|