def test_choi_to_kraus_inverse_of_kraus_to_choi(choi) -> None:
    """Verifies that cirq.kraus_to_choi(cirq.choi_to_kraus(.)) is identity on Choi matrices."""
    kraus = cirq.choi_to_kraus(choi)
    recovered_choi = cirq.kraus_to_choi(kraus)
    assert np.allclose(recovered_choi, choi)
Verifies that cirq.kraus_to_choi(cirq.choi_to_kraus(.)) is identity on Choi matrices.
cirq-core/cirq/qis/channels_test.py