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"><https://<b>groups.example.com</b>​/people'\ '​/a​_very​_long​_user​_id​?show​=Stufff>'\ '</a>' self.assertEqual(expected, r)
def test_http_angle_sub(self): 'Test an http-address in angle brackets is turned into a link' r = uriMatcher.sub('<http://example.com/>') expected = '<a href="http://example.com/"><http://<b>example.com</b>/></a>' self.assertEqual(expected, r)
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)
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>​/people​/me​?show​=Stufff</a>' self.assertEqual(expected, r)
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)