Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define returns_state in capabilities #220

Merged
merged 4 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
### Improvements

* Improvement of the different `requirements.txt` and `requirements-ci.txt` files.
[(#212)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/212)
[(#212)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/212)

* The plugin now natively supports the adjoint of the `S`, `T`, and `SX` gates.
[(#216)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/216)
Expand All @@ -16,10 +16,14 @@

* Use the centralized [Xanadu Sphinx Theme](https://github.com/XanaduAI/xanadu-sphinx-theme)
to style the Sphinx documentation.
[(#215)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/215)
[(#215)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/215)

### Bug fixes

* Defines the missing `returns_state` entry of the
`capabilities` dictionary for devices.
[(#220)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/220)

### Contributors

This release contains contributions from (in alphabetical order):
Expand Down
1 change: 1 addition & 0 deletions pennylane_qiskit/qiskit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def __init__(self, wires, provider, backend, shots=1024, **kwargs):
self.provider = provider
self.backend_name = backend
self._capabilities["backend"] = [b.name() for b in self.provider.backends()]
self._capabilities["returns_state"] = backend in self._state_backends

# Check that the backend exists
if backend not in self._capabilities["backend"]:
Expand Down
1 change: 1 addition & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_load_device(self, d, backend):
assert dev.shots == 1024
assert dev.short_name == d[0]
assert dev.provider == d[1]
assert dev.capabilities()["returns_state"] == (backend in state_backends)

def test_incorrect_backend(self):
"""Test that exception is raised if name is incorrect"""
Expand Down