コード例 #1
0
def test_invalid_request() -> None:
    token = cast(str, os.getenv("IONQ_AUTH"))
    b = IonQBackend(api_key=token, device_name="simulator", label="test 4")
    c = Circuit(2, 2).H(0).CZ(0, 1)
    c.measure_all()
    with pytest.raises(CircuitNotValidError) as excinfo:
        b.process_circuits([c], 100)
        assert "does not satisfy GateSetPredicate" in str(excinfo.value)
コード例 #2
0
def test_invalid_token() -> None:
    token = "invalid"
    b = IonQBackend(api_key=token, device_name="simulator", label="test 3")
    c = Circuit(2, 2).H(0).CX(0, 1)
    c.measure_all()
    b.compile_circuit(c)
    with pytest.raises(RuntimeError) as excinfo:
        b.process_circuits([c], 1)
        assert "Invalid key provided" in str(excinfo.value)