From 5770c5aabae11d9d69c8909b64875a41ef4ea32c Mon Sep 17 00:00:00 2001
From: Christoph Groth <christoph.groth@cea.fr>
Date: Fri, 5 May 2017 22:42:36 +0200
Subject: [PATCH] fix Builder.closest() test

---
 kwant/tests/test_builder.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kwant/tests/test_builder.py b/kwant/tests/test_builder.py
index 6e22d183..ada7cb9a 100644
--- a/kwant/tests/test_builder.py
+++ b/kwant/tests/test_builder.py
@@ -848,8 +848,11 @@ def test_closest():
             syst = builder.Builder(kwant.TranslationalSymmetry(*periods))
 
             for tag in rng.randint(-30, 31, (4, space_dim)):
-                # Add site.
-                syst[lat(*tag)] = None
+                # Add site and connect it to the others.
+                old_sites = list(syst.sites())
+                new_site = lat(*tag)
+                syst[new_site] = None
+                syst[((new_site, os) for os in old_sites)] = None
 
                 # Test consistency with fill().
                 for point in 200 * rng.random_sample((10, space_dim)) - 100:
-- 
GitLab