Example #1
0
 def test_condense_node_order(self):
     """condense_node_order condenses nodes in list based on index info"""
     matrix = self.matrix
     index = find_smallest_index(matrix)
     node_order = self.node_order
     node_order = condense_node_order(matrix, index, node_order)
     self.assertEqual(node_order[1], None)
     self.assertEqual(node_order[0].__str__(), "(a:0.5,b:0.5);")
     self.assertEqual(node_order[2].__str__(), "c;")
     self.assertEqual(node_order[3].__str__(), "d;")
     self.assertEqual(node_order[4].__str__(), "e;")
Example #2
0
 def test_condense_matrix(self):
     """condense_array joins two rows and columns identified by indices"""
     matrix = self.matrix
     index = find_smallest_index(matrix)
     result = condense_matrix(matrix, index, 9999999999)
     assert_allclose(result[0, 0], 5000000.0)
     self.assertEqual(result[1, 4], 9999999999)
     self.assertEqual(result[0, 1], 9999999999)
     self.assertEqual(result[0, 2], 4.5)
     self.assertEqual(result[2, 0], 4.5)
     self.assertEqual(result[0, 4], 22.5)
     self.assertEqual(result[4, 4], 9999999)
     self.assertEqual(result[4, 0], 22.5)
Example #3
0
 def test_find_smallest_index(self):
     """find_smallest_index returns the index of smallest value in array"""
     matrix = self.matrix
     index = find_smallest_index(matrix)
     self.assertEqual(index, (0, 1))