예제 #1
0
 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")
예제 #2
0
	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")
예제 #3
0
 def testg25_isComplete_almost(self):
     self.assertFalse(
         gf.is_complete(Graph({
             '1': ['2'],
             '2': ['1', '3'],
             '3': ['2']
         })), "G25")
예제 #4
0
 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)
예제 #5
0
 def test_is_complete_nongraph(self):
     g = []
     self.assertRaises(TypeError, lambda: graph_functions.is_complete(g))
예제 #6
0
	def test_is_complete_1Element(self):
		res = graph_functions.is_complete(self.g3)
		self.assertEqual(res, True, "Expected True for 1 element")
예제 #7
0
 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))
예제 #8
0
 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')
예제 #11
0
 def testg20_isComplete_type(self):
     with self.assertRaises(TypeError):
         gf.is_complete('A')
예제 #12
0
 def test_is_incomplete(self):
     self.assertFalse(is_complete(self.ab))
예제 #13
0
 def test_is_complete(self):
     self.assertTrue(is_complete(self.abc))
예제 #14
0
 def testg18_isComplete_true(self):
     self.assertTrue(gf.is_complete(self.complete), "G18")
     self.assertTrue(gf.is_complete(self.empty), "G18")
예제 #15
0
	def test_is_complete_Empty(self):
		res = graph_functions.is_complete(self.g0)
		self.assertEqual(res, True, "Expected True for empty")
예제 #16
0
 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))
예제 #17
0
	def test_is_complete_True(self):
		res = graph_functions.is_complete(self.g2)
		self.assertEqual(res, True, "Expected True")
예제 #18
0
	def test_is_complete_False(self):
		res = graph_functions.is_complete(self.g1)
		self.assertEqual(res, False, "Expected False")
예제 #19
0
 def test_iscomplete3(self):
     with self.assertRaises(TypeError):
         self.myGraph = my_adts.Queue()
         graph_functions.is_complete(self.myGraph)
예제 #20
0
 def test_is_incomplete(self):
     self.assertFalse(is_complete(self.ab))
 def test_is_complete_graph_complete(self):
     assert is_complete(self.graph) == True
예제 #22
0
 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
예제 #25
0
 def test_is_complete(self):
     self.assertTrue(is_complete(self.abc))