diff options
Diffstat (limited to 'tests/tasks')
| -rw-r--r-- | tests/tasks/test_receiver.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/tasks/test_receiver.py b/tests/tasks/test_receiver.py index 1943b65..6858be9 100644 --- a/tests/tasks/test_receiver.py +++ b/tests/tasks/test_receiver.py @@ -168,7 +168,33 @@ def test_html_mentions_relative_target(receiver: ModuleType) -> None: TARGET_URL, True, ), + pytest.param( + f"See {TARGET_URL}, thanks", TARGET_URL, True, id="trailing-comma" + ), + pytest.param(f"({TARGET_URL})", TARGET_URL, True, id="parenthesized-url"), + pytest.param( + f"See ({TARGET_URL}), thanks!", TARGET_URL, True, id="mixed-punctuation" + ), + pytest.param(f"See {TARGET_URL}. Next", TARGET_URL, True, id="trailing-period"), + pytest.param( + "https://example.com/wiki/Foo_(bar)", + "https://example.com/wiki/Foo_(bar)", + True, + id="balanced-parentheses-in-url", + ), + pytest.param( + "https://example.com/wiki/Foo_(bar)", + "https://example.com/wiki/Foo_(bar", + False, + id="balanced-parentheses-not-trimmed", + ), (f"{TARGET_URL}more", TARGET_URL, False), + pytest.param( + f"{TARGET_URL},another-page", + TARGET_URL, + False, + id="comma-within-longer-url", + ), ("https://dennisfink.me/blog/other/", TARGET_URL, False), ("/blog/example/", TARGET_URL, False), ("There are no links here.", TARGET_URL, False), @@ -339,6 +365,12 @@ def test_fetch_source_rejects_streamed_oversized_body( id="plain-text-utf-8", ), pytest.param( + "text/plain; charset=utf-8", + f"See ({TARGET_URL}), thanks".encode(), + True, + id="plain-text-with-surrounding-punctuation", + ), + pytest.param( "text/plain; charset=iso-8859-1", (f"Grüße. Reply to {TARGET_URL}").encode("iso-8859-1"), True, |
