예제 #1
0
 def test_hotlinked_image_with_alt_replaced(self):
     text = '<img src="https://example.com/some-image.gif" alt="picture"/>'
     self.assertEqual(
         replace_links_with_text(text),
         'https://example.com/some-image.gif (picture)'
     )
예제 #2
0
 def test_local_image_not_replaced(self):
     text = u'<img src="/some-image.gif"/>'
     self.assertEqual(
             replace_links_with_text(text), 
             u'<img src="/some-image.gif">'
         )
예제 #3
0
 def test_local_url_with_hotlinked_image_replaced(self):
     text = '<a href="/some-link"><img src="http://example.com/img.png" alt="picture""> some text</a>'
     self.assertEqual(
         replace_links_with_text(text),
         '<a href="/some-link">http://example.com/img.png (picture) some text</a>'
     )
예제 #4
0
 def test_external_link_without_text_replaced(self):
     text = '<a href="https://example.com/"></a>'
     #in this case we delete the link
     self.assertEqual(replace_links_with_text(text), '')
예제 #5
0
 def test_external_link_with_text_replaced(self):
     text = '<a href="https://example.com/">some link</a>'
     self.assertEqual(
         replace_links_with_text(text),
         'https://example.com/ (some link)'
     )
예제 #6
0
 def test_local_link_not_replaced(self):
     text = '<a href="/some-link">some link</a>'
     self.assertEqual(replace_links_with_text(text), text)
예제 #7
0
 def test_link_without_url_replaced(self):
     text = '<a>some link</a>'
     self.assertEqual(replace_links_with_text(text), 'some link')
예제 #8
0
 def test_local_url_with_hotlinked_image_replaced(self):
     text = '<a href="/some-link"><img src="http://example.com/img.png" alt="picture""> some text</a>'
     self.assertEqual(
         replace_links_with_text(text),
         '<a href="/some-link">http://example.com/img.png (picture) some text</a>'
     )
예제 #9
0
 def test_hotlinked_image_with_alt_replaced(self):
     text = '<img src="https://example.com/some-image.gif" alt="picture"/>'
     self.assertEqual(replace_links_with_text(text),
                      'https://example.com/some-image.gif (picture)')
예제 #10
0
 def test_local_image_not_replaced(self):
     text = u'<img src="/some-image.gif"/>'
     self.assertEqual(replace_links_with_text(text),
                      u'<img src="/some-image.gif">')
예제 #11
0
 def test_external_link_with_text_replaced(self):
     text = '<a href="https://example.com/">some link</a>'
     self.assertEqual(replace_links_with_text(text),
                      'https://example.com/ (some link)')
예제 #12
0
 def test_external_link_without_text_replaced(self):
     text = '<a href="https://example.com/"></a>'
     #in this case we delete the link
     self.assertEqual(replace_links_with_text(text), '')
예제 #13
0
 def test_link_without_url_replaced(self):
     text = '<a>some link</a>'
     self.assertEqual(replace_links_with_text(text), 'some link')
예제 #14
0
 def test_local_link_not_replaced(self):
     text = '<a href="/some-link">some link</a>'
     self.assertEqual(replace_links_with_text(text), text)