def test_input_distance_matrix():
    dist = distance_matrix(X, X, p=2)

    cc_ = CreateCliqueComplex(data=dist, alpha=alpha, data_type='matrix')
    cd_ = cc_.create_complex_from_graph()

    lap_cc = CreateLaplacianMatrices().fit(cd,
                                           (0, )).transform(cd)[0].todense()
    lap_cc_ = CreateLaplacianMatrices().fit(cd_,
                                            (0, )).transform(cd_)[0].todense()

    assert_almost_equal(lap_cc, lap_cc_)
import numpy as np
import pytest
import networkx as nx

from sklearn.exceptions import NotFittedError
from giotto.graphs.create_clique_complex import CreateCliqueComplex,\
    CreateLaplacianMatrices, CreateBoundaryMatrices

from numpy.testing import assert_almost_equal
from scipy.spatial import distance_matrix

X = np.random.random((10, 2))
alpha = 0.4
cc = CreateCliqueComplex(data=X, alpha=alpha, data_type='cloud')
cd = cc.create_complex_from_graph()


def test_graph_input_with_data_type():

    with pytest.raises(ValueError):
        CreateCliqueComplex(graph=nx.barbell_graph(10, 10), data_type='cloud')


def test_data_input_with__graph_data_type():

    with pytest.raises(ValueError):
        CreateCliqueComplex(data=X, alpha=alpha)


def test_input_distance_matrix():
    dist = distance_matrix(X, X, p=2)