From 05b8f5734c10f473d4c276a013d8c162c8a6c02b Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph@weston.cloud>
Date: Wed, 21 Aug 2019 12:40:23 +0200
Subject: [PATCH] add test for site family norbs <= 0

---
 kwant/tests/test_lattice.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kwant/tests/test_lattice.py b/kwant/tests/test_lattice.py
index e803514b..3f9088aa 100644
--- a/kwant/tests/test_lattice.py
+++ b/kwant/tests/test_lattice.py
@@ -237,6 +237,9 @@ def test_norbs():
     raises(ValueError, lattice.general, id_mat, norbs=1.5)
     raises(ValueError, lattice.general, id_mat, id_mat, norbs=1.5)
     raises(ValueError, lattice.general, id_mat, id_mat, norbs=[1.5, 1.5])
+    # should raise ValueError if norbs is <= 0
+    raises(ValueError, lattice.general, id_mat, norbs=0)
+    raises(ValueError, lattice.general, id_mat, norbs=-1)
     # test that lattices with different norbs are compared `not equal`
     lat = lattice.general(id_mat, basis=id_mat, norbs=None)
     lat1 = lattice.general(id_mat, basis=id_mat, norbs=1)
-- 
GitLab