def test_url_utf8():
"""Allow UTF8 characters in URLs themselves."""
outs = ('<a href="{0!s}" rel="nofollow">{0!s}</a>',
'<a rel="nofollow" href="{0!s}">{0!s}</a>')
out = lambda url: [x.format(url) for x in outs]
tests = (
('http://éxámplé.com/', out('http://éxámplé.com/')),
('http://éxámplé.com/íàñá/', out('http://éxámplé.com/íàñá/')),
('http://éxámplé.com/íàñá/?foo=bar',
out('http://éxámplé.com/íàñá/?foo=bar')),
('http://éxámplé.com/íàñá/?fóo=bár',
out('http://éxámplé.com/íàñá/?fóo=bár')),
)
def check(test, expected_output):
in_(expected_output, linkify(test))
for test, expected_output in tests:
yield check, test, expected_output
评论列表
文章目录