Example #1
0
 def test_case_a_e(self):
     r = Routes()
     r.read_csv("routes.csv")
     r.origin = "A"
     r.dest = "E"
     result = r.get_shortest_path()
     self.assertEqual(result, None)
     self.assertEqual(r.shortest_path, [])        
Example #2
0
 def test_case_e_h(self):
     r = Routes()
     r.read_csv("routes.csv")
     r.origin = "E"
     r.dest = "H"
     result = r.get_shortest_path()
     self.assertEqual(result["stop"], 2)
     self.assertEqual(result["total_time"], 20)
     self.assertEqual(r.shortest_path, ['E','F','G','H'])
Example #3
0
 def test_case_c_d(self):
     r = Routes()
     r.read_csv("routes.csv")
     r.origin = "C"
     r.dest = "D"
     result = r.get_shortest_path()
     self.assertEqual(result["stop"], 0)
     self.assertEqual(result["total_time"], 7)
     self.assertEqual(r.shortest_path, ['C','D'])
Example #4
0
 def test_case_a_b(self):
     r = Routes()
     r.read_csv("routes.csv")
     r.origin = "A"
     r.dest = "B"
     result = r.get_shortest_path()
     self.assertEqual(result["stop"], 0)
     self.assertEqual(result["total_time"], 5)
     self.assertEqual(r.shortest_path, ["A","B"])
Example #5
0
 def test_case_i_j(self):
     r = Routes()
     r.read_csv("routes.csv")
     r.origin = "I"
     r.dest = "J"
     result = r.get_shortest_path()
     self.assertEqual(result["stop"], 0)
     self.assertEqual(result["total_time"], 5)
     self.assertEqual(r.shortest_path, ['I','J'])
Example #6
0
 def test_case_h_j(self):
     r = Routes()
     r.read_csv("routes.csv")
     r.origin = "H"
     r.dest = "J"
     result = r.get_shortest_path()
     self.assertEqual(result["stop"], 1)
     self.assertEqual(result["total_time"], 15)
     self.assertEqual(r.shortest_path, ["H", "I","J"])
Example #7
0
 def test_case_g_i(self):
     r = Routes()
     r.read_csv("routes.csv")
     r.origin = "G"
     r.dest = "I"
     result = r.get_shortest_path()
     self.assertEqual(result["stop"], 1)
     self.assertEqual(result["total_time"], 20)
     self.assertEqual(r.shortest_path, ['G','H','I'])