Skip to content

Commit

Permalink
Fix correct backend assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
pimvenderbosch committed Jan 15, 2025
1 parent f377509 commit 625a07e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion qadence/pasqal_cloud_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_spec_from_model(
A `WorkloadSpec` instance based on the quantum model passed to this function.
"""
circuit = model._circuit.original
backend = model.backend
backend = model._backend_name
return WorkloadSpec(circuit, backend, result_types, parameter_values, observable)


Expand Down
11 changes: 10 additions & 1 deletion tests/test_pasqal_cloud_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
from torch import tensor

from qadence import BackendName, I, QuantumCircuit
from qadence import BackendName, I, QuantumCircuit, QuantumModel
from qadence.pasqal_cloud_connection import (
ResultType,
WorkloadNotDoneError,
Expand All @@ -15,6 +15,7 @@
_parameter_values_to_json,
check_status,
get_result,
get_spec_from_model,
upload_workload,
workload_spec_to_json,
)
Expand Down Expand Up @@ -74,6 +75,14 @@ def test_workload_spec_to_json_no_optionals() -> None:
assert "c_values" not in result.config.keys()


def test_get_spec_from_model(
BasicQuantumModel: QuantumModel, BasicQuantumCircuit: QuantumCircuit
) -> None:
workload = get_spec_from_model(BasicQuantumModel, [ResultType.EXPECTATION])
assert workload.circuit == BasicQuantumCircuit
assert workload.backend == BackendName.PYQTORCH


def test_upload_workload(mocker: Any, BasicQuantumCircuit: QuantumCircuit) -> None:
expected_workload_id = "my-workload"
mock_connection_return = mocker.Mock()
Expand Down

0 comments on commit 625a07e

Please sign in to comment.