def test_route_correct_route_2(self): route, cost = dijkstra(self.graph, 'B', 'B') self.assertEqual(route, ['B', 'C', 'E', 'B'])
def test_route_doesnt_exist(self): route = dijkstra(self.graph, 'D', 'A') self.assertEqual(route, 'NO SUCH ROUTE')
def test_route_correct_cost_2(self): route, cost = dijkstra(self.graph, 'B', 'B') self.assertEqual(cost, 9)
def test_dest_vertex_doesnt_exist_in_graph(self): with self.assertRaises(errors.DoesNotExistError) as context: dijkstra(self.graph, 'FEAR', 'C') self.assertTrue('does not exist as a connected vertex in the graph' in str(context.exception))