Added some test cases to the ExtractImages adaptor

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40482
This commit is contained in:
elpolilla 2008-12-08 16:33:11 +00:00
parent 686ab9dbd1
commit 4c0a4222ec
1 changed files with 5 additions and 2 deletions

View File

@ -32,9 +32,12 @@ class AdaptorsTestCase(unittest.TestCase):
sample_xsel = XmlXPathSelector(sample_response)
sample_adaptor = adaptors.ExtractImages(response=sample_response)
self.assertEqual(sample_adaptor(sample_xsel.x('//@href')),
self.assertEqual(sample_adaptor(None), [])
self.assertEqual(sample_adaptor([]), [])
self.assertEqual(sample_adaptor('http://foobar.com/my_image.jpg'), ['http://foobar.com/my_image.jpg'])
self.assertEqual(sample_adaptor([sample_xsel.x('//@href'), 'my_image.gif']),
[u'http://foobar.com/lala1/lala1.html', u'http://foobar.com/lala2.html',
u'http://foobar.com/pepepe/papapa/lala3.html', u'http://foobar.com/lala4.html'])
u'http://foobar.com/pepepe/papapa/lala3.html', u'http://foobar.com/lala4.html', u'http://foobar.com/my_image.gif'])
self.assertEqual(sample_adaptor(sample_xsel.x('//a')),
[u'http://foobar.com/lala1/lala1.html', u'http://foobar.com/lala2.html',
u'http://foobar.com/pepepe/papapa/lala3.html', u'http://foobar.com/imgs/lala4.jpg'])