def test_choi_to_kraus_action_on_operatorial_basis(choi) -> None:
    """Verifies that cirq.choi_to_kraus computes a valid Kraus representation."""
    kraus_operators = cirq.choi_to_kraus(choi)
    c = np.reshape(choi, (2, 2, 2, 2))
    for i in (0, 1):
        for j in (0, 1):
            input_rho = np.zeros((2, 2))
            input_rho[i, j] = 1
            actual_rho = apply_kraus_operators(kraus_operators, input_rho)
            expected_rho = c[:, i, :, j]
            assert np.allclose(actual_rho, expected_rho)
Verifies that cirq.choi_to_kraus computes a valid Kraus representation.
cirq-core/cirq/qis/channels_test.py