def test_is_complete(self): self.assertEqual( is_complete(self.g1), True, "T1: g1 is complete by definition of graph of 0, True") self.assertEqual( is_complete(self.g2), True, "T1: g2 is complete by definition of graph of 1, True") self.assertEqual(is_complete(self.g3), False, "T1: g3 is obviously not complete") self.assertEqual(is_complete(self.g4), True, "T1: g4 is by definition complete, True") self.assertEqual(is_complete(self.g5), None, "T1: g5 is not a graph")
def test_is_complete_Invalid(self): caught = False try: res = graph_functions.is_complete(self.not_a_graph) except TypeError: caught = True self.assertEqual(caught, True, "Expected True")
def testg25_isComplete_almost(self): self.assertFalse( gf.is_complete(Graph({ '1': ['2'], '2': ['1', '3'], '3': ['2'] })), "G25")
def test_is_complete_almost_complete(self): d = {} d["a"] = ["c", "d"] d["b"] = ["c", "d"] d["c"] = ["b", "a", "d"] d["d"] = ["b", "c", "a"] g = Graph(d) self.assertEqual(graph_functions.is_complete(g), False)
def test_is_complete_nongraph(self): g = [] self.assertRaises(TypeError, lambda: graph_functions.is_complete(g))
def test_is_complete_1Element(self): res = graph_functions.is_complete(self.g3) self.assertEqual(res, True, "Expected True for 1 element")
def test_iscomplete1(self): self.assertFalse(graph_functions.is_complete(self.myGraph)) self.myGraph.link_nodes('Node3', 'Node2') self.myGraph.link_nodes('Node3', 'Node4') self.assertTrue(graph_functions.is_complete(self.myGraph))
def test_is_complete_empty(self): g = Graph() self.assertEqual(graph_functions.is_complete(g), True)
def test_is_complete_single_node(self): assert is_complete(self.single_graph) == True
def test_is_complete_not_graph(self): #assert_raises(TypeError, is_complete, 'hello') with self.assertRaises(TypeError): is_complete('hello')
def testg20_isComplete_type(self): with self.assertRaises(TypeError): gf.is_complete('A')
def test_is_incomplete(self): self.assertFalse(is_complete(self.ab))
def test_is_complete(self): self.assertTrue(is_complete(self.abc))
def testg18_isComplete_true(self): self.assertTrue(gf.is_complete(self.complete), "G18") self.assertTrue(gf.is_complete(self.empty), "G18")
def test_is_complete_Empty(self): res = graph_functions.is_complete(self.g0) self.assertEqual(res, True, "Expected True for empty")
def test_iscomplete2(self): self.myGraph = my_adts.Graph() self.assertTrue(graph_functions.is_complete(self.myGraph)) self.myGraph.addNode('Node1') self.assertTrue(graph_functions.is_complete(self.myGraph))
def test_is_complete_True(self): res = graph_functions.is_complete(self.g2) self.assertEqual(res, True, "Expected True")
def test_is_complete_False(self): res = graph_functions.is_complete(self.g1) self.assertEqual(res, False, "Expected False")
def test_iscomplete3(self): with self.assertRaises(TypeError): self.myGraph = my_adts.Queue() graph_functions.is_complete(self.myGraph)
def test_is_complete_graph_complete(self): assert is_complete(self.graph) == True
def testg19_isComplete_false(self): self.assertFalse(gf.is_complete(self.disconnected), "G19")
def test_is_complete_graph_incomplete(self): assert is_complete(self.incom_graph) == False
def test_is_complete_empty_graph(self): assert is_complete(self.empty_graph) == True