def test_old_json():
    """Older versions of PauliStringPhasor did not have a qubit field."""
    old_json = """
    {
      "cirq_type": "PauliStringPhasor",
      "pauli_string": {
        "cirq_type": "PauliString",
        "qubit_pauli_map": [
          [
            {
              "cirq_type": "LineQubit",
              "x": 0
            },
            {
              "cirq_type": "_PauliX",
              "exponent": 1.0,
              "global_shift": 0.0
            }
          ],
          [
            {
              "cirq_type": "LineQubit",
              "x": 1
            },
            {
              "cirq_type": "_PauliY",
              "exponent": 1.0,
              "global_shift": 0.0
            }
          ],
          [
            {
              "cirq_type": "LineQubit",
              "x": 2
            },
            {
              "cirq_type": "_PauliZ",
              "exponent": 1.0,
              "global_shift": 0.0
            }
          ]
        ],
        "coefficient": {
          "cirq_type": "complex",
          "real": 1.0,
          "imag": 0.0
        }
      },
      "exponent_neg": 0.2,
      "exponent_pos": 0.1
    }
    """
    phasor = cirq.read_json(json_text=old_json)
    assert phasor == cirq.PauliStringPhasor(
        (
            (1 + 0j)
            * cirq.X(cirq.LineQubit(0))
            * cirq.Y(cirq.LineQubit(1))
            * cirq.Z(cirq.LineQubit(2))
        ),
        qubits=(cirq.LineQubit(0), cirq.LineQubit(1), cirq.LineQubit(2)),
        exponent_neg=0.2,
        exponent_pos=0.1,
    )
Older versions of PauliStringPhasor did not have a qubit field.
cirq-core/cirq/ops/pauli_string_phasor_test.py