def test_graph_with_airport(self):

        print(" ========== AirportsDatabase testing ======= time start= ")
        airportsDb = AirportsDatabase()
        assert (airportsDb.read())

        airportsDb.dumpCountry(Country="France")
        print("number of airports= ", airportsDb.getNumberOfAirports())

        for ap in [
                'Orly', 'paris', 'toulouse', 'marseille', 'roissy', 'blagnac',
                'provence', 'de gaulle'
        ]:
            print("ICAO Code of= ", ap, " ICAO code= ",
                  airportsDb.getICAOCode(ap))

        t1 = time.clock()
        print(" ========== AirportsDatabase testing ======= time start= ", t1)
        CharlesDeGaulleRoissy = airportsDb.getAirportFromICAOCode('LFPG')
        print(CharlesDeGaulleRoissy)
        MarseilleMarignane = airportsDb.getAirportFromICAOCode('LFML')
        print(MarseilleMarignane)

        g0 = Graph()
        for icao in ['LFPO', 'LFMY', 'LFAT', 'LFGJ']:
            airport = airportsDb.getAirportFromICAOCode(icao)
            g0.addVertex(airport)
        print('================ g0 =================')
        for node in g0.getVertices():
            print(node)
        self.assertEqual(g0.getNumberOfVertices(), 4)

        g1 = Graph()
        for icao in ['LFKC', 'LFBO', 'LFKB']:
            airport = airportsDb.getAirportFromICAOCode(icao)
            g1.addVertex(airport)
        self.assertEqual(g1.getNumberOfVertices(), 3)

        print('================ g1 =================')
        for node in g1.getVertices():
            print(node)

        print(' ============== g0.add_graph(g1) ===============')
        g0.addGraph(g1)
        for node in g0.getVertices():
            print(node)

        self.assertEqual(g0.getNumberOfVertices(), 7)

        print('============== g0.create XLS file ===============')

        g0.createXlsxOutputFile()
        g0.createKmlOutputFile()
Exemplo n.º 2
0
    def test_main(self):

        t0 = time.process_time()
        print(' ========== AirportsDatabase testing ======= ')
        airportsDb = AirportsDatabase()
        ret = airportsDb.read()
        self.assertTrue(ret)
        t1 = time.process_time()
        print(t1 - t0)

        print(' ========== AirportsDatabase testing ======= ')

        airportsDb.dumpCountry(Country="France")
        print("number of airports= ", airportsDb.getNumberOfAirports())

        print(' ========== AirportsDatabase testing ======= ')

        for ap in [
                'Orly', 'paris', 'toulouse', 'marseille', 'roissy', 'blagnac',
                'provence', 'de gaulle'
        ]:
            print("ICAO Code of= ", ap, " ICAO code= ",
                  airportsDb.getICAOCode(ap))

        t2 = time.process_time()
        print(t2 - t1)
        print('========== AirportsDatabase testing ======= ')
        CharlesDeGaulleRoissy = airportsDb.getAirportFromICAOCode('LFPG')
        print(CharlesDeGaulleRoissy)

        print(' ========== AirportsDatabase testing ======= ')
        MarseilleMarignane = airportsDb.getAirportFromICAOCode('LFML')
        print(MarseilleMarignane)

        print(' ========== AirportsDatabase testing ======= ')
        Lisbonne = airportsDb.getAirportFromICAOCode('LPPT')
        print(Lisbonne)

        print(' ========== AirportsDatabase testing ======= ')
        JohnFKennedy = airportsDb.getAirportFromICAOCode('KJFK')
        self.assertTrue(isinstance(JohnFKennedy, Airport))
        print(JohnFKennedy)

        print('========== AirportsDatabase testing =======')
        LosAngeles = airportsDb.getAirportFromICAOCode('KLAX')
        print(LosAngeles)

        self.assertTrue(True)
Exemplo n.º 3
0
    def test_main_four(self):

        print " ========== AirportsDatabase testing ======= time start= "
        airportsDb = AirportsDatabase()
        assert (airportsDb.read())
        airportsDb.dumpCountry(Country="France")
        print "number of airports= ", airportsDb.getNumberOfAirports()
        for ap in [
                'Orly', 'paris', 'toulouse', 'marseille', 'roissy', 'blagnac',
                'provence', 'de gaulle'
        ]:
            print "ICAO Code of= ", ap, " ICAO code= ", airportsDb.getICAOCode(
                ap)

        t1 = time.clock()
        print " ========== AirportsDatabase testing ======= time start= ", t1
        CharlesDeGaulleRoissy = airportsDb.getAirportFromICAOCode('LFPG')
        print CharlesDeGaulleRoissy
        MarseilleMarignane = airportsDb.getAirportFromICAOCode('LFML')
        print MarseilleMarignane

        g0 = Graph()
        for icao in ['LFPO', 'LFMY', 'LFAT', 'LFGJ']:
            airport = airportsDb.getAirportFromICAOCode(icao)
            g0.addVertex(airport)
        print '================ g0 ================='
        for node in g0.getVertices():
            print node

        g1 = Graph()
        for icao in ['LFKC', 'LFBO', 'LFKB']:
            airport = airportsDb.getAirportFromICAOCode(icao)
            g1.addVertex(airport)

        print '================ g1 ================='
        for node in g1.getVertices():
            print node

        print ' ============== g0.add_graph(g1) ==============='
        g0.addGraph(g1)
        for node in g0.getVertices():
            print node

        print ' ============== g0.create XLS file ==============='

        g0.createXlsxOutputFile()
        g0.createKmlOutputFile()
    def test_main_four(self):    

        print " ========== AirportsDatabase testing ======= time start= "
        airportsDb = AirportsDatabase()
        assert (airportsDb.read())
        airportsDb.dumpCountry(Country="France")
        print "number of airports= ", airportsDb.getNumberOfAirports()
        for ap in ['Orly', 'paris', 'toulouse', 'marseille' , 'roissy', 'blagnac' , 'provence' , 'de gaulle']:
            print "ICAO Code of= ", ap, " ICAO code= ", airportsDb.getICAOCode(ap)
        
        t1 = time.clock()
        print " ========== AirportsDatabase testing ======= time start= ", t1
        CharlesDeGaulleRoissy = airportsDb.getAirportFromICAOCode('LFPG')
        print CharlesDeGaulleRoissy
        MarseilleMarignane = airportsDb.getAirportFromICAOCode('LFML')
        print MarseilleMarignane
        
        g0 = Graph()
        for icao in [ 'LFPO', 'LFMY', 'LFAT', 'LFGJ']:
            airport = airportsDb.getAirportFromICAOCode(icao)
            g0.addVertex(airport)
        print '================ g0 =================' 
        for node in g0.getVertices():
            print node
        
        g1 = Graph()
        for icao in [ 'LFKC', 'LFBO' , 'LFKB']:
            airport = airportsDb.getAirportFromICAOCode(icao)
            g1.addVertex(airport)     
            
        print '================ g1 =================' 
        for node in g1.getVertices():
            print node
            
        print ' ============== g0.add_graph(g1) ==============='
        g0.addGraph(g1)
        for node in g0.getVertices():
            print node
            
        print ' ============== g0.create XLS file ==============='
    
        g0.createXlsxOutputFile()
        g0.createKmlOutputFile()