Skip to content

Commit 271a521

Browse files
committed
tests: add test for align_layout()
1 parent 1f48b47 commit 271a521

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_layouts.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22
from math import hypot
3-
from igraph import Graph, Layout, BoundingBox, InternalError
3+
from igraph import Graph, Layout, BoundingBox, InternalError, align_layout
44
from igraph import umap_compute_weights
55

66

@@ -452,6 +452,13 @@ def testDRL(self):
452452
lo = g.layout("drl")
453453
self.assertTrue(isinstance(lo, Layout))
454454

455+
def testAlign(self):
456+
g = Graph.Ring(3, circular=False)
457+
lo = Layout([[1,1], [2,2], [3,3]])
458+
lo = align_layout(g, lo)
459+
self.assertTrue(isinstance(lo, Layout))
460+
self.assertTrue(all(abs(lo[i][1]) < 1e-10 for i in range(3)))
461+
455462

456463
def suite():
457464
layout_suite = unittest.defaultTestLoader.loadTestsFromTestCase(LayoutTests)

0 commit comments

Comments
 (0)