Beispiel #1
0
    def test_interLinks_with_good_episode_web(self):
        """Returns a list of links"""
        expect0 = 74  # number of links expected
        expect1 = '/s/ngo/4/2/1/5/222'  #example of link

        result = extract.interLinks(self.fixt)
        print result
        self.assertEqual(len(result), expect0)  # number of results
        self.assertEqual(result[0], expect1)  # results are good
Beispiel #2
0
    def test_interLinks_with_good_episode_web(self):
        """Returns a list of links"""
        expect0 = 74  # number of links expected
        expect1 = '/s/ngo/4/2/1/5/222'  #example of link

        result = extract.interLinks(self.fixt)
        print result
        self.assertEqual(len(result), expect0)  # number of results
        self.assertEqual(result[0], expect1)  # results are good
Beispiel #3
0
    def get_episode_data(self, episodeLink=""):
        try:
            # - to retrieve the links to intermediate, we need to
            # - get the webcontent
            logging.debug("opening a website")
            episodeWeb = extract.openWebsite(episodeLink)
            # extract the interlinks
            self.linksInter = extract.interLinks(episodeWeb)
            # - and the data of the episode
            self.details = extract.episodeDataFromEpisodeWeb(episodeWeb)
            logging.debug("details")
            logging.debug(repr(self.details))
            return self.details, self.linksInter

        except:
            raise  # TODO
Beispiel #4
0
    def get_episode_data(self, episodeLink = ""):
        try:
            # - to retrieve the links to intermediate, we need to
            # - get the webcontent
            logging.debug("opening a website")
            episodeWeb = extract.openWebsite(episodeLink)
            # extract the interlinks
            self.linksInter = extract.interLinks(episodeWeb)
            # - and the data of the episode
            self.details = extract.episodeDataFromEpisodeWeb(episodeWeb)
            logging.debug("details")
            logging.debug(repr(self.details))
            return self.details, self.linksInter


        except:
            raise  # TODO
Beispiel #5
0
 def test_interLinks_raise_with_bad_html(self):
     """raises exception if no links found"""
     extract.interLinks("<html><head></head><body></body></html>")
Beispiel #6
0
 def test_interLinks_raise_with_bad_html(self):
     """raises exception if no links found"""
     extract.interLinks("<html><head></head><body></body></html>")