def test_deserialize_circuit_with_token_strings():
    """Supporting token strings for backwards compatibility."""
    serializer = cg.CircuitSerializer()
    proto = v2.program_pb2.Program(
        language=v2.program_pb2.Language(arg_function_language='exp', gate_set=_SERIALIZER_NAME),
        circuit=v2.program_pb2.Circuit(
            scheduling_strategy=v2.program_pb2.Circuit.MOMENT_BY_MOMENT, moment_indices=[2]
        ),
        constants=[
            v2.program_pb2.Constant(qubit=v2.program_pb2.Qubit(id='2_4')),
            v2.program_pb2.Constant(
                operation_value=v2.program_pb2.Operation(
                    xpowgate=v2.program_pb2.XPowGate(
                        exponent=v2.program_pb2.FloatArg(float_value=1.0)
                    ),
                    token_value='abc123',
                    qubit_constant_index=[0],
                )
            ),
            v2.program_pb2.Constant(moment_value=v2.program_pb2.Moment(operation_indices=[1])),
        ],
    )
    tag = cg.CalibrationTag('abc123')
    circuit = cirq.Circuit(cirq.X(Q0).with_tags(tag))
    assert serializer.deserialize(proto) == circuit
Supporting token strings for backwards compatibility.
cirq-google/cirq_google/serialization/circuit_serializer_test.py