Skip to content

Commit

Permalink
HilbertSpace: Fix unit test after krivenko/libcommute@da20d5f
Browse files Browse the repository at this point in the history
  • Loading branch information
krivenko committed Jul 1, 2024
1 parent 2c95c59 commit 40724ce
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/test_hilbert_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,26 +327,27 @@ def counter(i):

def test_very_big_space(self):
hs1 = HilbertSpace()
for i in range(32):
for i in range(31):
hs1.add(make_space_spin(3 / 2, "s", i))

with self.assertRaisesRegex(
RuntimeError,
"Hilbert space size is not representable by a 64-bit integer "
"\\(n_bits = 66\\)"
"\\(n_bits = 64\\)"
):
hs1.add(make_space_spin(3 / 2, "s", 32))
hs1.add(make_space_spin(3 / 2, "s", 31))

expr = ExpressionR(1.0)
for i in range(32):
for i in range(31):
expr *= S_p("s", i, spin=3 / 2)
expr *= S_p("s", 31, spin=1 / 2)
hs2 = HilbertSpace(expr)
self.assertEqual(hs2.total_n_bits, 64)
self.assertEqual(hs2.total_n_bits, 63)

expr *= S_p("s", 32, spin=3 / 2)
with self.assertRaisesRegex(
RuntimeError,
"Hilbert space size is not representable by a 64-bit integer "
"\\(n_bits = 66\\)"
"\\(n_bits = 65\\)"
):
HilbertSpace(expr)

0 comments on commit 40724ce

Please sign in to comment.