def test_to_proto(): q = XmonQubit(5, 6) # Create a new message. proto = q.to_proto() assert proto.row == 5 assert proto.col == 6 # Populate an existing message. proto2 = operations_pb2.Qubit() q.to_proto(proto2) assert proto2.row == 5 assert proto2.col == 6
def test_from_proto(): q = XmonQubit(5, 6) q2 = XmonQubit.from_proto(q.to_proto()) assert q2 == q