diff --git a/tests/test_gates_gates.py b/tests/test_gates_gates.py index 67fe0229f2..ed3e6cc4a3 100644 --- a/tests/test_gates_gates.py +++ b/tests/test_gates_gates.py @@ -698,6 +698,9 @@ def test_cun(backend, name, params): gate = getattr(gates, name)(0, 1, **params) + if name == "CRY": + decomposition = gate.decompose() + assert gate.unitary if name != "CU2": @@ -723,10 +726,10 @@ def test_cun(backend, name, params): backend.assert_allclose(final_state, target_state, atol=1e-6) if name == "CRY": - decomposition = Circuit(2) - decomposition.add(gate.decompose()) - decomposition = decomposition.unitary(backend=backend) - backend.assert_allclose(decomposition, _matrix) + matrix = Circuit(2) + matrix.add(decomposition) + matrix = matrix.unitary(backend=backend) + backend.assert_allclose(matrix, _matrix) def test_swap(backend):