Added a urlize test for wrapping characters.

This commit is contained in:
Tim Graham 2018-10-11 10:49:54 -04:00 committed by Carlton Gibson
parent fb5dfd53a7
commit 70a80ff1be
1 changed files with 18 additions and 0 deletions

View File

@ -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'),