From f6f2d996b3838dda0e541cc113fa23f3e6d6c47e Mon Sep 17 00:00:00 2001
From: Rafal Skolasinski <r.j.skolasinski@gmail.com>
Date: Fri, 5 May 2017 15:29:31 +0200
Subject: [PATCH] improve test for double substitutions in
 'continuum.discretize'

Previously, only onsite matrix elements were tested, whereas the
test should have also tested the hopping elements.
---
 kwant/continuum/tests/test_discretizer.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kwant/continuum/tests/test_discretizer.py b/kwant/continuum/tests/test_discretizer.py
index b6d7222e..6b35d2d6 100644
--- a/kwant/continuum/tests/test_discretizer.py
+++ b/kwant/continuum/tests/test_discretizer.py
@@ -395,7 +395,7 @@ def test_numeric_functions_basic_string():
 
 
 @pytest.mark.parametrize('e_to_subs, e, subs', [
-    ('A * k_x + V', '(A + B) * k_x + A + B', {'A': 'A + B', 'V': 'A + B'}),
+    ('A * k_x + A', '(A + B) * k_x + A + B', {'A': 'A + B'}),
 ])
 def test_numeric_functions_with_subs(e_to_subs, e, subs):
     p = {'A': 1, 'B': 2}
@@ -405,6 +405,10 @@ def test_numeric_functions_with_subs(e_to_subs, e, subs):
     lat = next(iter(builder_direct.sites()))[0]
     assert builder_direct[lat(0)](None, **p) == builder_subs[lat(0)](None, **p)
 
+    hop_direct = builder_direct[lat(0), lat(1)](None, None, **p)
+    hop_subs = builder_subs[lat(0), lat(1)](None, None, **p)
+    assert  hop_direct == hop_subs
+
 
 
 def test_numeric_functions_advance():
-- 
GitLab