def get_elements(self): for sub in self.data['subreddit'].split(','): for p in reddit.subreddit_posts(sub=sub.strip(), order_by=self.data['order'], limit=self.data['limit'], time=self.data['time']): if self.check_filters(p): yield p
def test_subreddit_submissions(self): """ Load submissions from a subreddit """ self.assertGreater(len( [p for p in pw.subreddit_posts('shadow_test_sub', limit=5)]), 3, msg='Loaded too few Posts.')
def test_post_orders(self): """ All post orders should find a result from a subreddit """ for order, time in pw.post_orders() + [('best', False)]: post = next(pw.subreddit_posts('funny', order, 1, 'all')) self.assertTrue(post, msg="Failed to find '%s' post." % order)