Exemple #1
0
def test_wrong_dims():
    np_matrix = np.random.randn(3, 3, 3).astype(np.float32)
    assert (np_matrix.ndim == 3)
    # c_matrix only supports ndim == 2
    with pytest.raises(ValueError):
        # Check whether a Value Error is raised
        e.matrixXf(np_matrix)
Exemple #2
0
def test_none_type():
    np_matrix = None
    with pytest.raises(TypeError):
        # Check whether a Value Error is raised
        e.matrixXf(np_matrix)
Exemple #3
0
def test_wrong_type():
    np_matrix = np.random.randn(3, 3).astype(np.float64)
    # c_matrix requies type np.float32
    with pytest.raises(ValueError):
        # Check whether a Value Error is raised
        e.matrixXf(np_matrix)
Exemple #4
0
def test_matrix_conversion():
    np_matrix = np.random.randn(3, 3).astype(np.float32)
    assert (np_matrix.ndim == 2)
    c_matrix = e.matrixXf(np_matrix)
    assert np.all(np.array(c_matrix) == np_matrix)