Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesB-1qbit committed Nov 1, 2022
1 parent 0aea371 commit 2935680
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tangelo/toolboxes/ansatz_generator/adapt_ansatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def update_var_params(self, var_params):
def prepare_reference_state(self):
"""Prepare a circuit generating the HF reference state."""
if self.reference_state.upper() == "HF":
return get_reference_circuit(n_spinorbitals=self.n_spinorbitals, n_electrons=self.n_electrons, mapping=self.mapping, up_then_down=self.up_then_down, spin=self.spin)
return get_reference_circuit(n_spinorbitals=self.n_spinorbitals, n_electrons=self.n_electrons,
mapping=self.mapping, up_then_down=self.up_then_down, spin=self.spin)
else:
return Circuit(n_qubits=get_qubit_number(self.mapping, self.n_spinorbitals))

Expand Down
6 changes: 3 additions & 3 deletions tangelo/toolboxes/ansatz_generator/tests/test_adapt_ansatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ class ADAPTAnsatzTest(unittest.TestCase):
def test_adaptansatz_init(self):
"""Verify behavior of ADAPTAnsatz class."""

ansatz = ADAPTAnsatz(n_spinorbitals=4, n_electrons=2)
ansatz = ADAPTAnsatz(n_spinorbitals=4, n_electrons=2, spin=0)
ansatz.build_circuit()

def test_adaptansatz_adding(self):
"""Verify operator addition behavior of ADAPTAnsatz class."""

ansatz = ADAPTAnsatz(n_spinorbitals=4, n_electrons=2)
ansatz = ADAPTAnsatz(n_spinorbitals=4, n_electrons=2, spin=0)
ansatz.build_circuit()

ansatz.add_operator(qu_op)
Expand All @@ -46,7 +46,7 @@ def test_adaptansatz_adding(self):
def test_adaptansatz_set_var_params(self):
"""Verify variational parameter tuning behavior of ADAPTAnsatz class."""

ansatz = ADAPTAnsatz(n_spinorbitals=4, n_electrons=2)
ansatz = ADAPTAnsatz(n_spinorbitals=4, n_electrons=2, spin=0)
ansatz.build_circuit()

ansatz.add_operator(qu_op)
Expand Down

0 comments on commit 2935680

Please sign in to comment.