예제 #1
0
 def test_read_rate_matrix(self):
     arr = [[-3, 1, 1, 1], [1, -3, 1, 1], [1, 1, -3, 1], [1, 1, 1, -3]]
     s = '\n'.join('\t'.join(str(x) for x in row) for row in arr)
     sio = StringIO(s)
     M = np.array(matrixio.read_matrix(sio))
     assert_rate_matrix(M)
예제 #2
0
 def test_read_square_matrix_good(self):
     s = '1 2 3 \n 4 5 6 \n 7 8 9'
     row_major_observed = matrixio.read_matrix(StringIO(s))
     row_major_expected = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
     self.assertEquals(row_major_observed, row_major_expected)
예제 #3
0
 def test_read_square_matrix_bad(self):
     s = '1 2 3 \n 4 5 6'
     M = np.array(matrixio.read_matrix(StringIO(s)))
     self.assertRaises(MatrixError, assert_square, M)
예제 #4
0
 def test_read_rate_matrix(self):
     arr = [[-3, 1, 1, 1], [1, -3, 1, 1], [1, 1, -3, 1], [1, 1, 1, -3]]
     s = '\n'.join('\t'.join(str(x) for x in row) for row in arr)
     sio = StringIO(s)
     M = np.array(matrixio.read_matrix(sio))
     assert_rate_matrix(M)
예제 #5
0
 def test_read_square_matrix_good(self):
     s = '1 2 3 \n 4 5 6 \n 7 8 9'
     row_major_observed = matrixio.read_matrix(StringIO(s))
     row_major_expected = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
     self.assertEquals(row_major_observed, row_major_expected)
예제 #6
0
 def test_read_square_matrix_bad(self):
     s = '1 2 3 \n 4 5 6'
     M = np.array(matrixio.read_matrix(StringIO(s)))
     self.assertRaises(MatrixError, assert_square, M)