def test_op_identifier():
    """Check that converted parametric defgates will be correctly identified."""
    theta, beta = Parameter("theta"), Parameter("beta")
    xy_matrix = np.array(
        [
            [1, 0, 0, 0],
            [0, quil_cos(theta / 2), 1j * quil_sin(theta / 2) * quil_exp(1j * beta), 0],
            [0, 1j * quil_sin(theta / 2) * quil_exp(1j * beta), 1j * quil_cos(theta / 2), 0],
            [0, 0, 0, 1],
        ]
    )

    defgate = DefGate("PHASEDXY", xy_matrix, parameters=[beta, theta])

    gate1 = defgate_to_cirq(defgate)
    gate2 = defgate_to_cirq(defgate)

    op = gate1(beta=np.pi, theta=np.pi)(cirq.LineQubit(0), cirq.LineQubit(1))

    assert op in cirq.OpIdentifier(gate1)
    assert op in cirq.OpIdentifier(gate2)
Check that converted parametric defgates will be correctly identified.
cirq-rigetti/cirq_rigetti/quil_input_test.py