コード例 #1
0
 def test_long_https_angle_sub(self):
     'Test a long https-address in angle brackets is turned into a link'
     text = '<https://groups.example.com/people/a_very_long_user_id?show=Stufff>'
     r = uriMatcher.sub(text)
     expected = '<a class="small" href="https://groups.example.com/people/'\
         'a_very_long_user_id?show=Stufff">&lt;https://<b>groups.example.com</b>&#8203;/people'\
         '&#8203;/a&#8203;_very&#8203;_long&#8203;_user&#8203;_id&#8203;?show&#8203;=Stufff&gt;'\
         '</a>'
     self.assertEqual(expected, r)
コード例 #2
0
 def test_http_angle_sub(self):
     'Test an http-address in angle brackets is turned into a link'
     r = uriMatcher.sub('&lt;http://example.com/&gt;')
     expected = '<a href="http://example.com/">&lt;http://<b>example.com</b>/&gt;</a>'
     self.assertEqual(expected, r)
コード例 #3
0
 def test_http_path_sub(self):
     'Test a http-address with a path is turned into a link'
     r = uriMatcher.sub('http://example.com/people/me')
     expected = '<a href="http://example.com/people/me">http://<b>example.com</b>/people/me</a>'
     self.assertEqual(expected, r)
コード例 #4
0
 def test_http_query_sub(self):
     'Test an http-address with a query string is turned into a link'
     r = uriMatcher.sub('http://example.com/people/me?show=Stufff')
     expected = '<a href="http://example.com/people/me?show=Stufff">'\
         'http://<b>example.com</b>&#8203;/people&#8203;/me&#8203;?show&#8203;=Stufff</a>'
     self.assertEqual(expected, r)
コード例 #5
0
 def test_https_sub(self):
     'Test that an https-address is turned into a link'
     r = uriMatcher.sub('https://example.com')
     self.assertEqual('<a href="https://example.com">https://<b>example.com</b></a>', r)