def test_inverse_x(self, num_ctrl_qubits):
     """Test inverting the controlled X gate."""
     cnx = XGate().control(num_ctrl_qubits)
     inv_cnx = cnx.inverse()
     result = Operator(cnx).compose(Operator(inv_cnx))
     np.testing.assert_array_almost_equal(result.data,
                                          np.identity(result.dim[0]))