diff --git a/tests/test_transpilers_blocks.py b/tests/test_transpilers_blocks.py index d9294cf4f..6941603bd 100644 --- a/tests/test_transpilers_blocks.py +++ b/tests/test_transpilers_blocks.py @@ -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)])