summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-10-11 10:49:54 -0400
committerCarlton Gibson <carlton.gibson@noumenal.es>2018-10-12 08:13:52 +0200
commit70a80ff1be054622ab0db1af5e58bf15b42b7a2e (patch)
tree0e47388f58bb1c18fd98e52c98b42f409d420aab /tests
parentfb5dfd53a784ee76f71de12edee995ef984cc925 (diff)
Added a urlize test for wrapping characters.
Diffstat (limited to 'tests')
-rw-r--r--tests/template_tests/filter_tests/test_urlize.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/template_tests/filter_tests/test_urlize.py b/tests/template_tests/filter_tests/test_urlize.py
index 2bf94126d4..649a965203 100644
--- a/tests/template_tests/filter_tests/test_urlize.py
+++ b/tests/template_tests/filter_tests/test_urlize.py
@@ -278,6 +278,24 @@ class FunctionTests(SimpleTestCase):
'http://168.192.0.1](http://168.192.0.1)</a>',
)
+ def test_wrapping_characters(self):
+ wrapping_chars = (
+ ('()', ('(', ')')),
+ ('<>', ('&lt;', '&gt;')),
+ ('[]', ('[', ']')),
+ ('""', ('&quot;', '&quot;')),
+ ("''", ('&#39;', '&#39;')),
+ )
+ for wrapping_in, (start_out, end_out) in wrapping_chars:
+ with self.subTest(wrapping_in=wrapping_in):
+ start_in, end_in = wrapping_in
+ self.assertEqual(
+ urlize(start_in + 'https://www.example.org/' + end_in),
+ start_out +
+ '<a href="https://www.example.org/" rel="nofollow">https://www.example.org/</a>' +
+ end_out,
+ )
+
def test_ipv4(self):
self.assertEqual(
urlize('http://192.168.0.15/api/9'),