From 70a80ff1be054622ab0db1af5e58bf15b42b7a2e Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 11 Oct 2018 10:49:54 -0400 Subject: [PATCH] Added a urlize test for wrapping characters. --- .../template_tests/filter_tests/test_urlize.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/template_tests/filter_tests/test_urlize.py b/tests/template_tests/filter_tests/test_urlize.py index 2bf94126d40..649a9652033 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)', ) + def test_wrapping_characters(self): + wrapping_chars = ( + ('()', ('(', ')')), + ('<>', ('<', '>')), + ('[]', ('[', ']')), + ('""', ('"', '"')), + ("''", (''', ''')), + ) + 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 + + 'https://www.example.org/' + + end_out, + ) + def test_ipv4(self): self.assertEqual( urlize('http://192.168.0.15/api/9'),