def test_url_utf8():
 out = u'<a href="%(url)s" rel="nofollow">%(url)s</a>'
 tests = (('http://\xc3\xa9x\xc3\xa1mpl\xc3\xa9.com/', (out % {'url': u'http://\xe9x\xe1mpl\xe9.com/'})), ('http://\xc3\xa9x\xc3\xa1mpl\xc3\xa9.com/\xc3\xad\xc3\xa0\xc3\xb1\xc3\xa1/', (out % {'url': u'http://\xe9x\xe1mpl\xe9.com/\xed\xe0\xf1\xe1/'})), ('http://\xc3\xa9x\xc3\xa1mpl\xc3\xa9.com/\xc3\xad\xc3\xa0\xc3\xb1\xc3\xa1/?foo=bar', (out % {'url': u'http://\xe9x\xe1mpl\xe9.com/\xed\xe0\xf1\xe1/?foo=bar'})), ('http://\xc3\xa9x\xc3\xa1mpl\xc3\xa9.com/\xc3\xad\xc3\xa0\xc3\xb1\xc3\xa1/?f\xc3\xb3o=b\xc3\xa1r', (out % {'url': u'http://\xe9x\xe1mpl\xe9.com/\xed\xe0\xf1\xe1/?f\xf3o=b\xe1r'})))
 def check(test, expected_output):
  eq_(expected_output, linkify(test))
 for (test, expected_output) in tests:
  (yield (check, test, expected_output))

def test_url_utf8 ( ) : out = u'<a href="%(url)s" rel="nofollow">%(url)s</a>' tests = ( ( 'http://\xc3\xa9x\xc3\xa1mpl\xc3\xa9.com/' , ( out % { 'url' : u'http://\xe9x\xe1mpl\xe9.com/' } ) ) , ( 'http://\xc3\xa9x\xc3\xa1mpl\xc3\xa9.com/\xc3\xad\xc3\xa0\xc3\xb1\xc3\xa1/' , ( out % { 'url' : u'http://\xe9x\xe1mpl\xe9.com/\xed\xe0\xf1\xe1/' } ) ) , ( 'http://\xc3\xa9x\xc3\xa1mpl\xc3\xa9.com/\xc3\xad\xc3\xa0\xc3\xb1\xc3\xa1/?foo=bar' , ( out % { 'url' : u'http://\xe9x\xe1mpl\xe9.com/\xed\xe0\xf1\xe1/?foo=bar' } ) ) , ( 'http://\xc3\xa9x\xc3\xa1mpl\xc3\xa9.com/\xc3\xad\xc3\xa0\xc3\xb1\xc3\xa1/?f\xc3\xb3o=b\xc3\xa1r' , ( out % { 'url' : u'http://\xe9x\xe1mpl\xe9.com/\xed\xe0\xf1\xe1/?f\xf3o=b\xe1r' } ) ) ) def check ( test , expected_output ) : eq_ ( expected_output , linkify ( test ) ) for ( test , expected_output ) in tests : ( yield ( check , test , expected_output ) )
allow utf8 characters in urls themselves .