Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
graph-Dijikstra/graph_dijskstra_testing.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42 lines (33 sloc)
1.4 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import sys | |
import io | |
import re | |
from graph_dijikstra import Dijikstra_graphs | |
class Dijikstra_graphs_testing(unittest.TestCase): | |
def setUp(self): | |
graph_weighted_dictionary = { | |
1:{2:1,3:6}, | |
2:{1:1,3:2,4:1}, | |
3:{1:6,2:2,4:2,5:5}, | |
4:{2:1,3:2,5:5}, | |
5:{3:5,4:5} | |
} | |
self.graph = Dijikstra_graphs(graph_weighted_dictionary) | |
def test_object_of_class(self): | |
self.assertIsInstance(self.graph,Dijikstra_graphs) | |
def test_add_vertex(self): | |
add_vertex = self.graph.add_vertex(5) | |
self.assertEqual(add_vertex,'vertex alrerady present in graph') | |
add_vertex = self.graph.add_vertex(6) | |
self.assertEqual(add_vertex,'Vertex Added to graph') | |
def test_add_edge_weight(self): | |
add_edge_weight = self.graph.add_edge_weight(12) | |
self.assertEqual(add_edge_weight,'Vertex not present in graph') | |
add_vertex = self.graph.add_vertex(6) | |
add_edge_weight = self.graph.add_edge_weight([6,2,12]) | |
self.assertEqual(add_edge_weight,'Edge added to Vertex') | |
def test_shortest_path(self): | |
shortest_path = self.graph.shortest_path() | |
self.assertNotEqual(shortest_path,shortest_path) | |
if __name__ == '__main__': | |
unittest.main() |