Skip to content

Commit

Permalink
Add regression test for recover_configurations (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-johnson authored Jan 31, 2025
1 parent d3950ed commit 1ee8ddb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/test_configuration_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ def test_recover_configurations(self):
)
self.assertTrue((expected_mat == mat_rec).all())
self.assertTrue((expected_probs == probs_rec).all())
with self.subTest("Basic test. Mismatching orbitals."):
bs_mat = np.array([[True, True, True, True]])
probs = np.array([1.0])
occs = [0.0, 1.0, 0.0, 0.0]
num_a = 0
num_b = 1
expected_mat = np.array([[False, True, False, False]])
expected_probs = np.array([1.0])
mat_rec, probs_rec = recover_configurations(
bs_mat, probs, occs, num_a, num_b, rand_seed=4224
)
self.assertTrue((expected_mat == mat_rec).all())
self.assertTrue((expected_probs == probs_rec).all())
with self.subTest("Test with more than 72 bits. Ones to zeros."):
n_bits = 74
rng = np.random.default_rng(554)
Expand Down

0 comments on commit 1ee8ddb

Please sign in to comment.