Skip to content

Commit

Permalink
transpiler test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoLiegiBastonLiegi committed Nov 2, 2023
1 parent c993c2b commit a007d64
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_transpilers_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ def test_circuit_blocks():
assert block.name == index
reconstructed_circ = circuit_blocks.circuit()
# Here we can't use assert gates_equality because the order of the gates is changed
np.testing.assert_allclose(circ().state().get(), reconstructed_circ().state().get())
state = circ().state()
reconstructed_state = reconstructed_circ().state()
if not isinstance(state, np.ndarray):
state = state.get()
reconstructed_state = reconstructed_state.get()
np.testing.assert_allclose(state, reconstructed_state)
first_block = circuit_blocks.search_by_index(0)
assert_gates_equality(first_block.gates, [gates.H(1), gates.H(0), gates.CZ(0, 1), gates.H(0), gates.CZ(0, 1)])

Expand Down

0 comments on commit a007d64

Please sign in to comment.