diff tests/test_distance.py @ 14:27925261c137

fix broken tests including an aggregious case where we add ourselves as a neighbor to ourself
author Jeff Hammel <k0scist@gmail.com>
date Sun, 25 Jun 2017 14:29:18 -0700
parents 254195d0bac2
children
line wrap: on
line diff
--- a/tests/test_distance.py	Sun Jun 25 14:04:49 2017 -0700
+++ b/tests/test_distance.py	Sun Jun 25 14:29:18 2017 -0700
@@ -124,9 +124,12 @@
             assert max([len(value) for value in neighbors.values()]) <= k
 
             # assert distances increase
-            for value in neighbors.values():
+            for key, value in neighbors.items():
                 distances = [i[-1] for i in value]
                 assert distances == sorted(distances)
+                neighbors = [i[0] for i in value]
+                assert key not in neighbors
+                assert len(set(neighbors)) == len(neighbors)
 
     def test_insert_distances(self):
         """test insert distances algorithm"""