def test(self):
     parser = RedditParser()
     parser.feed(self.html)
     for i in range(0, len(parser.posts)):
         parsed = parser.posts[i]
         actual = self.posts[i]
         self.assertEqual(parsed[0], actual[0])
         self.assertEqual(parsed[1], actual[1])
def selectPicture(url):
    logger.info('wat')
    # u = ctypes.windll.user32
    r = openURL(url)
    if r == None:
        logger.critical('empty request response')
    else:
        parser = RedditParser()
        parser.feed(r.text)
        post = parser.nextImagePost()
        # screenWidth = u.GetSystemMetrics(0)
        # screenHeight = u.GetSystemMetrics(1)
        screenWidth = 2560
        screenHeight = 1600
        while post.height < screenHeight or post.width < screenWidth:
            logger.info('post \"' + post.title + '\" is too small (screen size is ' + str(screenWidth) + 'x' + str(screenHeight) + ')')
            post = parser.nextImagePost()
        return post