def test_get_graph(self): """ Tests if the method "get_graph" is in order :return: True if so """ print("first test") algo = GraphAlgo() self.assertTrue(algo.get_graph()) print("Completed")
def testa_transpose(self): """ This method checks if the method 'transpose', that we chose to implement is working the way we wished for :return: True if it does """ print("sixth test") algo = GraphAlgo(self.single_node_graph()) trans = algo.transpose() self.assertEqual(trans, algo.get_graph()) print("Completed")
def test_ccg_graph(self): """ This test checks if the graph is strongly connected :return: True if it does """ print("eighth test") graph = DiGraph() graph.add_node(100) algo = GraphAlgo() algo.graph = graph ans = algo.connected_components() self.assertEqual([[100]], ans) g_algo = GraphAlgo(self.connected_graph()) res = g_algo.connected_components() exp = [] for i in g_algo.get_graph().graph_nodes: exp.append(i) self.assertEqual([exp], res) print("Completed")