def testDataNew(self): newFile = 'https://wiki.engr.illinois.edu/download/attachments/207295743/cmi_hub.json?version=1&modificationDate=1349245386000' newAirline = Airline() newAirline.airlineInit(newAirline.airportDic, newFile) newAirline.adjInit(newAirline.adjList, newAirline.adjOneWay, newFile) newAirline.setSources(newAirline.sources, newFile) newAirline.getDists() newAirline.cityOps() self.assertEquals(newAirline.longestFlight, 1836) self.assertEquals(newAirline.shortestFlight, 132) self.assertEquals(newAirline.avgCityPop, 226000)
import Code.Airport from Code.Airline import Airline import cProfile from Code.UserInterface import UserInterface from Code.UpdateAirport import UpdateAirport import webbrowser import urllib ''' https://wiki.engr.illinois.edu/download/attachments/207292263/map_data.json?version=1&modificationDate=1348635625000 https://wiki.engr.illinois.edu/download/attachments/207295743/cmi_hub.json?version=1&modificationDate=1349245386000 ''' if __name__ == '__main__': ''' Does the UI and airline creation, and runs the UI ''' airlineObj = Airline() simpleUI = UserInterface(airlineObj) file = str(raw_input('Please enter the url or filepath of the JSON file to load')) while True: airlineObj.airlineInit(airlineObj.airportDic, file) airlineObj.adjInit(airlineObj.adjList, airlineObj.adjOneWay, file) airlineObj.setSources(airlineObj.sources, file) airlineObj.getDists() airlineObj.cityOps() file = raw_input('If you have another to enter, please enter it. If not, press q') if file == 'q': break while True: flag = simpleUI.decideInfo() if int(flag) == 0: break
def testNewJSON(self): newFile = 'https://wiki.engr.illinois.edu/download/attachments/207295743/cmi_hub.json?version=1&modificationDate=1349245386000' newAirline = Airline() newAirline.airlineInit(newAirline.airportDic, newFile) newAirline.adjInit(newAirline.adjList, newAirline.adjOneWay, newFile) newAirline.setSources(newAirline.sources, newFile) newAirline.getDists() newAirline.cityOps() self.assertEquals(len(newAirline.airportDic), 1) self.assertEquals(len(newAirline.adjList), 10)
''' Created on Sep 30, 2012 @author: Jeff ''' import unittest from Code.Airline import Airline from Code.Route import Route airlineObj = Airline() file = 'https://wiki.engr.illinois.edu/download/attachments/207292263/map_data.json?version=1&modificationDate=1348635625000' airlineObj.airlineInit(airlineObj.airportDic, file) airlineObj.adjInit(airlineObj.adjList, airlineObj.adjOneWay, file) airlineObj.setSources(airlineObj.sources, file) airlineObj.getDists() airlineObj.cityOps() ''' A series of tests on my functions in the airline class ''' class Test(unittest.TestCase): ''' A total test of the city variables 48 airports, and 94 flights ''' def testCityTot(self): minPop = airlineObj.minCityPop minPopName = airlineObj.minCityName self.assertEquals(minPop, 589900) self.assertEquals(minPopName, "Essen") maxPop = airlineObj.maxCityPop maxPopName = airlineObj.maxCityName
''' Created on Sep 30, 2012 @author: Jeff ''' import unittest from Code.Airline import Airline from Code.Route import Route airlineObj = Airline() file = 'https://wiki.engr.illinois.edu/download/attachments/207292263/map_data.json?version=1&modificationDate=1348635625000' airlineObj.airlineInit(airlineObj.airportDic, file) airlineObj.adjInit(airlineObj.adjList, airlineObj.adjOneWay, file) airlineObj.setSources(airlineObj.sources, file) airlineObj.getDists() airlineObj.cityOps() ''' A series of tests on my functions in the airline class ''' class Test(unittest.TestCase): ''' A total test of the city variables 48 airports, and 94 flights ''' def testCityTot(self): minPop = airlineObj.minCityPop minPopName = airlineObj.minCityName self.assertEquals(minPop, 589900) self.assertEquals(minPopName, "Essen") maxPop = airlineObj.maxCityPop