Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_simplices(self):
mapper = KeplerMapper()
X = np.random.rand(100, 2)
lens = mapper.fit_transform(X)
graph = mapper.map(
lens,
X=X,
cover=Cover(n_cubes=3, perc_overlap=0.75),
clusterer=cluster.DBSCAN(metric="euclidean", min_samples=3),
)
assert max([len(s) for s in graph["simplices"]]) <= 2
nodes = [n for n in graph["simplices"] if len(n) == 1]
edges = [n for n in graph["simplices"] if len(n) == 2]
assert len(nodes) == 3
assert len(edges) == 3
def test_remove_duplicates_argument(self, capsys):
mapper = KeplerMapper(verbose=1)
X = np.random.rand(100, 5)
lens = mapper.project(X)
graph = mapper.map(
lens,
X=X,
cover=Cover(n_cubes=2, perc_overlap=1),
clusterer=cluster.DBSCAN(metric="euclidean", min_samples=3),
remove_duplicate_nodes=True,
)
captured = capsys.readouterr()
assert "duplicate nodes" in captured[0]