Added a urlize test for wrapping characters.
This commit is contained in:
parent
fb5dfd53a7
commit
70a80ff1be
|
@ -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 = (
|
||||
('()', ('(', ')')),
|
||||
('<>', ('<', '>')),
|
||||
('[]', ('[', ']')),
|
||||
('""', ('"', '"')),
|
||||
("''", (''', ''')),
|
||||
)
|
||||
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'),
|
||||
|
|
Loading…
Reference in New Issue