Skip to content

Commit

Permalink
Lint and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
laurencap committed Nov 7, 2023
1 parent 299bdf0 commit 04bbc30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/braket/tasks/gate_model_quantum_task_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ def __eq__(self, other) -> bool:
return self.task_metadata.id == other.task_metadata.id
return NotImplemented

def get_compiled_circuit(self) -> str:
def get_compiled_circuit(self) -> Optional[str]:
"""
Get the compiled circuit, if one is available.
Returns:
str: The compiled circuit or None.
Optional[str]: The compiled circuit or None.
"""
metadata = self.additional_metadata
if not metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def result_oqc(task_metadata_shots, additional_metadata_oqc):
return GateModelQuantumTaskResult.from_object(result)



@pytest.fixture
def result_str_1(result_obj_1):
return result_obj_1.json()
Expand Down Expand Up @@ -337,6 +336,13 @@ def test_get_compiled_circuit(result_obj_1):
assert result.get_compiled_circuit() == None


def test_get_compiled_circuit_no_metadata(result_obj_1):
"""Test that the method does not raise an error if metadata is missing."""
result = GateModelQuantumTaskResult.from_object(result_obj_1)
result.additional_metadata = None
assert result.get_compiled_circuit() == None


def test_measurement_counts_from_measurements():
measurements: np.ndarray = np.array(
[[1, 0, 1, 0], [0, 0, 0, 0], [1, 0, 1, 0], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 1, 0]]
Expand Down

0 comments on commit 04bbc30

Please sign in to comment.