Beispiel #1
0
def test_invalid_data_pauli_sum():
    qubit_count = 1
    ascii_symbols = ["foo"]
    probX = 0.1
    probY = 0.1
    probZ = 0.9
    PauliNoise(probX, probY, probZ, qubit_count, ascii_symbols)
Beispiel #2
0
def pauli_noise():
    return PauliNoise(probX=0.1,
                      probY=0.2,
                      probZ=0.3,
                      qubit_count=1,
                      ascii_symbols=["foo"])
Beispiel #3
0
def test_invalid_data_type_pauli_probZ(probZ):
    qubit_count = 1
    ascii_symbols = ["foo"]
    probX = 0.1
    probY = 0.1
    PauliNoise(probX, probY, probZ, qubit_count, ascii_symbols)
            SingleProbabilisticNoise(0.1, 1, ["foo"]),
            "SingleProbabilisticNoise(0.1)",
            "SingleProbabilisticNoise('probability': 0.1, 'qubit_count': 1)",
        ),
        (
            DampingNoise(0.1, 1, ["foo"]),
            "DampingNoise(0.1)",
            "DampingNoise('gamma': 0.1, 'qubit_count': 1)",
        ),
        (
            GeneralizedAmplitudeDampingNoise(0.1, 0.2, 1, ["foo"]),
            "GeneralizedAmplitudeDampingNoise(0.1, 0.2)",
            "GeneralizedAmplitudeDampingNoise('gamma': 0.1, 'probability': 0.2, 'qubit_count': 1)",
        ),
        (
            PauliNoise(0.1, 0.2, 0.3, 1, ["foo"]),
            "PauliNoise(0.1, 0.2, 0.3)",
            "PauliNoise('probX': 0.1, 'probY': 0.2, 'probZ': 0.3, 'qubit_count': 1)",
        ),
        (
            MultiQubitPauliNoise({"X": 0.2}, 1, ["foo"]),
            "MultiQubitPauliNoise({'X': 0.2})",
            "MultiQubitPauliNoise('probabilities' : {'X': 0.2}, 'qubit_count': 1)",
        ),
    ],
)
def test_noise_str_repr(noise, expected_string, expected_repr):
    assert str(noise) == expected_string
    assert repr(noise) == expected_repr