Ejemplo n.º 1
0
def test_base_without_href():
  eq_(find_image_urls(html='<base target="_blank"><img src="xyzzy">'), ['xyzzy'])
Ejemplo n.º 2
0
def test_img_without_src():
  eq_(find_image_urls(html='<img title="An owl' \
    ' peering out from a hole in a brick wall.">'), [])
Ejemplo n.º 3
0
def test_empty():
  eq_(find_image_urls(html=""), [])
Ejemplo n.º 4
0
def test_one_with_base_and_url():
  eq_(find_image_urls(
    url='https://localhost/lolcats/index.html',
    html='<base href="best/index.html"/>' \
         '<img src="im-in-ur-computer-stealing-ur-megahurtz.png">'),
    ['https://localhost/lolcats/best/im-in-ur-computer-stealing-ur-megahurtz.png'])
Ejemplo n.º 5
0
def test_one_with_base():
  eq_(find_image_urls(
    html='<base href="https://localhost/lolcats/best.html"/>' \
         '<img src="invisible_sandwich.gif">'),
    ['https://localhost/lolcats/invisible_sandwich.gif'])
Ejemplo n.º 6
0
def test_one_with_url():
  eq_(find_image_urls(url='http://scholr.ly/authors/index.html',
    html='<img src="erdos.jpg">'),
    ['http://scholr.ly/authors/erdos.jpg'])
Ejemplo n.º 7
0
def test_two_duplicate():
  eq_(find_image_urls(html='<img src="a" title="x"/><img src="a" width=24>',
    duplicate=True), ['a', 'a'])
Ejemplo n.º 8
0
def test_two_duplicate_removed():
  eq_(find_image_urls(html='<img src="a" title="x"/><img src="a" width=24>'), ['a'])
Ejemplo n.º 9
0
def test_one():
  eq_(find_image_urls(html='<img src="a">'), ['a'])