def test_query(self): results = google.query("site:imdb.com how i met your mother") self.assertTrue(len(results) == 10) self.assertTrue("imdb.com" in results[0]["link"]) # the link should point to imdb.com self.assertTrue("tt0460649" in results[0]["link"]) # the link should contain the id of the series with self.assertRaises(TypeError): google.query([])
def _getimdburl(showname): results = google.query("site:www.imdb.com {}".format(showname)) return results[0]['link']