From 8ed9b47b7a5df35ce1f5cb84efad4bc6ddf65814 Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph.weston@cea.fr>
Date: Tue, 18 Aug 2015 14:26:34 +0200
Subject: [PATCH] add support for *args to HermConjOfFunc

---
 kwant/builder.py            | 4 ++--
 kwant/tests/test_builder.py | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kwant/builder.py b/kwant/builder.py
index 320613af..35e25c54 100644
--- a/kwant/builder.py
+++ b/kwant/builder.py
@@ -373,8 +373,8 @@ class HermConjOfFunc(object):
     def __init__(self, function):
         self.function = function
 
-    def __call__(self, i, j):
-        return herm_conj(self.function(j, i))
+    def __call__(self, i, j, *args):
+        return herm_conj(self.function(j, i, *args))
 
 
 ################ Leads
diff --git a/kwant/tests/test_builder.py b/kwant/tests/test_builder.py
index 6aa6ea74..52ab1e19 100644
--- a/kwant/tests/test_builder.py
+++ b/kwant/tests/test_builder.py
@@ -141,10 +141,10 @@ def test_construction_and_indexing():
 
 
 def test_hermitian_conjugation():
-    def f(i, j):
+    def f(i, j, arg):
         i, j = i.tag, j.tag
         if j[0] == i[0] + 1:
-            return ta.array([[1, 2j], [3 + 1j, 4j]])
+            return arg * ta.array([[1, 2j], [3 + 1j, 4j]])
         else:
             raise ValueError
 
@@ -155,8 +155,8 @@ def test_hermitian_conjugation():
     sys[sg(0), sg(1)] = f
     assert sys[sg(0), sg(1)] is f
     assert isinstance(sys[sg(1), sg(0)], builder.HermConjOfFunc)
-    assert_equal(sys[sg(1), sg(0)](sg(1), sg(0)),
-                 sys[sg(0), sg(1)](sg(0), sg(1)).conjugate().transpose())
+    assert_equal(sys[sg(1), sg(0)](sg(1), sg(0), 2),
+                 sys[sg(0), sg(1)](sg(0), sg(1), 2).conjugate().transpose())
     sys[sg(0), sg(1)] = sys[sg(1), sg(0)]
     assert isinstance(sys[sg(0), sg(1)], builder.HermConjOfFunc)
     assert sys[sg(1), sg(0)] is f
-- 
GitLab