コード例 #1
0
 def test_submission_gallery(self):
     """ Parse all gallery links """
     p = pw.get_submission(t3_id='t3_hrrh23')
     re = RedditElement(p)
     self.assertEqual(
         len(re.get_urls()),
         3,
         msg='Got incorrect image count from reddit gallery submission!')
     for url in re.get_urls():
         self.assertIn('https',
                       url,
                       msg='Failed to extract valid gallery URL: %s' % url)
コード例 #2
0
 def test_gallery(self):
     """ Should load all gallery images """
     ps = PushshiftAPI()
     post, = ps.search_submissions(limit=1, ids=['t3_hrrh23'])
     re = RedditElement(post)
     self.assertEqual(
         len(re.get_urls()),
         3,
         msg='Got incorrect image count from PSAW gallery submission!')
     for url in re.get_urls():
         self.assertIn('https',
                       url,
                       msg='Failed to extract valid gallery URL: %s' % url)