def test_weird_query_strings(self): """Ensure strange characters are handled""" links = parse_links( 'http://pjuu.com:5000/a/post/url?page=1&q=abc,def#something') self.assertEqual( links[0]['link'], 'http://pjuu.com:5000/a/post/url?page=1&q=abc,def#something')
def test_quoting_mentions_hashtags(self): """Parenthesis around items""" links = parse_links('"https://pjuu.com/user1"') self.assertEqual(links[0]['link'], 'https://pjuu.com/user1') hashtags = parse_hashtags('"#pjuu"') self.assertEqual(hashtags[0]['hashtag'], 'pjuu') mentions = parse_mentions('"@joe"', check_user=False) self.assertEqual(mentions[0]['username'], 'joe')
def test_anchors_in_urls(self): """Query strings and anchor points""" links = parse_links('https://pjuu.com/joe?page=2#hello') self.assertEqual(links[0]['link'], 'https://pjuu.com/joe?page=2#hello')
def test_urls_are_fixed(self): """Ensure simple link are fixed up.""" links = parse_links('Hello pjuu.com') self.assertEqual(links[0]['link'], 'http://pjuu.com') self.assertEqual(links[0]['span'], (6, 14))
def test_simple_url_https(self): """Simpe HTTPS urls""" links = parse_links('Hello https://pjuu.com') self.assertEqual(links[0]['link'], 'https://pjuu.com')
def test_parenethesis_in_paths(self): """Handle URLs surrounded by parenthesis and containing them.""" links = parse_links('(https://pjuu.com/user1)') self.assertEqual(links[0]['link'], 'https://pjuu.com/user1') links = parse_links('https://pjuu.com/user1(awesome)') self.assertEqual(links[0]['link'], 'https://pjuu.com/user1(awesome)')