def setUp(self): # create & init objects self.homePage_one = homeLink(HOMEPAGE_ONE) self.homePage_two = homeLink(HOMEPAGE_TWO) self.subPage = pageLink(SUBPAGE, SUBTAGS) self.stData = storeData()
def addPage(self, pageURL, pageTags): # increment Homepage Count self.incCount() # create pageLink object page = pageLink(pageURL, pageTags) # inc. pageLink if already in dict. if pageURL in self.pageLinks: self.pageLinks[pageURL].incCount() # else add pageLink to dict. else: self.pageLinks[pageURL] = page # add Tags to homeLink self.addTags(pageTags)
import sys from pageLink import pageLink from homeLink import homeLink from storeData import storeData from storeData import storeData stData = storeData() homeL = homeLink("http://www.google.com") pageL = pageLink("http://www.google.com/avengers", ['python', 'C++']) def main(): stData.addPage("http://www.google.com/avengers", ['jello', 'python']) print stData.getSearchData() homeL = stData.getLink("http://www.google.com/") print homeL.getPageLinks() pass if __name__ == '__main__': main()