Skip to content

Commit

Permalink
Add custom repr to qss.SuperstaqBackend (#1055)
Browse files Browse the repository at this point in the history
Adds a similar repr returned by `qiskit.providers.BackendV1` before
#1036

---------

Co-authored-by: richrines1 <[email protected]>
  • Loading branch information
bharat-thotakura and richrines1 authored Sep 6, 2024
1 parent 168a88d commit 5c1d07a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qiskit-superstaq/qiskit_superstaq/superstaq_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def __eq__(self, other: Any) -> bool:

return self._provider == other._provider and self.target_info() == other.target_info()

def __repr__(self) -> str:
return f"<{self.__class__.__name__}('{self.name}')>"

def configuration(self) -> BackendConfiguration:
"""Retrieves configuration information for this target.
Expand Down
5 changes: 5 additions & 0 deletions qiskit-superstaq/qiskit_superstaq/superstaq_backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
from qiskit_superstaq.conftest import MockSuperstaqProvider


def test_repr(fake_superstaq_provider: MockSuperstaqProvider) -> None:
backend = fake_superstaq_provider.get_backend("ss_example_qpu")
assert repr(backend) == "<SuperstaqBackend('ss_example_qpu')>"


def test_run(fake_superstaq_provider: MockSuperstaqProvider) -> None:
qc = qiskit.QuantumCircuit(2, 2)
qc.h(0)
Expand Down

0 comments on commit 5c1d07a

Please sign in to comment.