[test] Write the test for test_findneighbours_clustering
authorSimon Chabot <simon.chabot@logilab.fr>
Tue, 13 Nov 2012 16:41:31 +0100
changeset 125 07fe131b44d0
parent 124 9e21516d69e1
child 126 752233f1a0b3
[test] Write the test for test_findneighbours_clustering
test/test_alignment.py
--- a/test/test_alignment.py	Tue Nov 13 16:04:17 2012 +0100
+++ b/test/test_alignment.py	Tue Nov 13 16:41:31 2012 +0100
@@ -309,18 +309,19 @@
         for align in ([[2, 4], [1]], [[0], [0]], [[3], [2]]):
             self.assertIn(align, neighbours)
 
-    ## def test_findneighbours_clustering(self):
-    ##     alignset = [['V1', 'label1', (6.14194444444, 48.67)],
-    ##                 ['V2', 'label2', (6.2, 49)],
-    ##                 ['V3', 'label3', (5.1, 48)],
-    ##                 ['V4', 'label4', (5.2, 48.1)],
-    ##                 ]
-    ##     targetset = [['T1', 'labelt1', (6.2, 48.9)],
-    ##                  ['T2', 'labelt2', (5.3, 48.2)],
-    ##                  ['T3', 'labelt3', (6.25, 48.91)],
-    ##                  ]
-    ##     neighbours = alig.findneighbours_clustering(alignset, targetset, indexes=(2, 2), threshold=0.3)
-    ##     self.assertEqual(neighbours, [[[0], [0, 2]], [[1], [0, 2]], [[2], [1]], [[3], [1]]])
+    def test_findneighbours_clustering(self):
+        alignset = [['V1', 'label1', (6.14194444444, 48.67)],
+                    ['V2', 'label2', (6.2, 49)],
+                    ['V3', 'label3', (5.1, 48)],
+                    ['V4', 'label4', (5.2, 48.1)],
+                    ]
+        targetset = [['T1', 'labelt1', (6.2, 48.9)],
+                     ['T2', 'labelt2', (5.3, 48.2)],
+                     ['T3', 'labelt3', (6.25, 48.91)],
+                     ]
+        neighbours = alig.findneighbours_clustering(alignset, targetset, indexes=(2, 2))
+        for neighbour in neighbours:
+            self.assertIn(neighbour, [[[0, 1], [0, 2]], [[2, 3], [1]]])
 
     def test_align(self):
         alignset = [['V1', 'label1', (6.14194444444, 48.67)],