Commit 6be8c43d authored by Joseph Weston's avatar Joseph Weston Committed by Anton Akhmerov
Browse files

use tinyarrays for Site tags in tests, rather than tuples

Tinyarrays used to have identical hashes to tuples, but this
was not part of the official interface. While the core of
Kwant did not depend on this implementation detail, the
tests did.
parent a1095b72
......@@ -332,7 +332,7 @@ def test_finalization():
"""
def set_sites(dest):
while len(dest) < n_sites:
site = rng.randrange(size), rng.randrange(size)
site = ta.array([rng.randrange(size), rng.randrange(size)])
if site not in dest:
dest[site] = random_onsite_hamiltonian(rng)
......@@ -368,7 +368,7 @@ def test_finalization():
a = rng.choice(lead_sites_list)
b = rng.choice(possible_neighbors)
neighbors.add(b)
b = b[0] - size, b[1]
b = ta.array([b[0] - size, b[1]])
if rng.randrange(2):
a, b = b, a
if (a, b) not in lead_hops and (b, a) not in lead_hops:
......@@ -409,7 +409,7 @@ def test_finalization():
lead[fam(*a), fam(*b)] = value
flead = lead.finalized()
all_sites = list(lead_sites)
all_sites.extend((x - size, y) for (x, y) in neighbors)
all_sites.extend(ta.array([x - size, y]) for (x, y) in neighbors)
check_id_by_site(fsyst)
check_onsite(flead, all_sites, check_values=False)
check_onsite(flead, lead_sites, subset=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment