def test_get_info(self): htmlcover = open(os.path.join(HTML_DIR, "cover.html")).read() info = pysheng.get_info(htmlcover) self.assertEqual('http://books.google.com/books?id=2TowtKyI27wC&lpg=PP1&ie=ISO-8859-1', info["prefix"]) self.assertEqual(172, len(info["page_ids"])) self.assertEqual("Artistic Theory in Italy", info["title"]) self.assertEqual("Anthony Blunt", info["attribution"])
def test_get_info(self): htmlcover = open(os.path.join(HTML_DIR, "cover.html")).read() info = pysheng.get_info(htmlcover) self.assertEqual('http://books.google.com/books?id=2TowtKyI27wC&' 'lpg=PP1&ie=ISO-8859-1', info["prefix"]) self.assertEqual(172, len(info["page_ids"])) self.assertEqual("Artistic Theory in Italy", info["title"]) self.assertEqual("Anthony Blunt", info["attribution"])
def get_info(widgets, url, opener): debug = widgets.debug html = yield asyncjobs.ProgressDownloadThreadedTask( url, opener, headers=HEADERS, elapsed_cb=functools.partial(on_elapsed, widgets, "info")) try: info = pysheng.get_info(html) except ValueError, detail: debug("Error parsing page HTML: %s" % str(detail)) raise