def testGetWikiEvents(self): events = fetcher.getWikiFightByName() self.assertEqual('UFC on Fox: Johnson vs. Bader',fetcher.findEventByName('UFC on Fox: Johnson vs. Bader', events).name) self.assertEqual('/wiki/UFC_on_Fox:_Johnson_vs._Bader', events[0].site) self.assertEqual(datetime.date(2016,1,30), events[0].date) self.assertEqual('UFC on Fox: Johnson vs. Bader', events[0].name)
def testUnicode(self): events = fetcher.getWikiFightByName() for e in events: if('illa'.decode() in e.name ): print e.name
def testEventMatching(self): events = fetcher.getWikiFightByName() for event in events: eventname = event.name.encode('utf-8') fetchedEvent = fetcher.getEventPageFromName(eventname)[0].encode('utf-8') ratio = fetcher.compareStringSimilarity(eventname, fetchedEvent) if(ratio< 0.9): print eventname+" |\t | "+fetchedEvent+'|\t ratio:'+str(ratio)
def testCreateEvent(self): events = fetcher.getWikiFightByName() event = events[0] wlobjs = fetcher.getWikiFightResults(event.site) #url = fetcher.getEventPageFromName(event.name) data =fetcher.getEventDataByName(event.name) result = fetcher.joinResultAndLines(data,wlobjs) self.assertEqual('Stephen Thompson',result[0].fightWinnerWinner) self.assertEqual(1.34,result[0].fighterOneLine) self.assertEqual(3.45,result[0].fighterTwoLine)