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()
def test_graph_three_vertexs(self): g2 = Graph() v3 = Vertex('Marie') g2.addVertex(v3) g1 = Graph() v1 = Vertex('Robert') v2 = Vertex('Francois') g1.addVertex(v1) g1.addVertex(v2) g1.addGraph(g2) print(g1) self.assertEqual(g1.getNumberOfVertices(), 3) for vertex in g1.getVertices(): print(vertex) print("=================") for edge in g1.getEdges(): print(edge.getTail(), edge.getHead())