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

Small fixes for compatibility with most recent Qiskit version #347

Merged
merged 7 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion pennylane_qiskit/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ def _function(params: dict = None, wires: list = None):

# Processing the dictionary of parameters passed
for op, qargs, cargs in qc.data:
instruction_name = op.__class__.__name__
# the new Singlton classes have different names than the objects they represnet, but base_class.__name__ still matches
lillian542 marked this conversation as resolved.
Show resolved Hide resolved
instruction_name = op.base_class.__name__
lillian542 marked this conversation as resolved.
Show resolved Hide resolved

operation_wires = [wire_map[hash(qubit)] for qubit in qargs]

Expand Down
15 changes: 0 additions & 15 deletions tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,21 +267,6 @@ def test_extra_parameters_were_passed(self, recorder):
with recorder:
quantum_circuit(params={theta: x, phi: y})

def test_quantum_circuit_error_by_passing_wrong_parameters(self, recorder):
lillian542 marked this conversation as resolved.
Show resolved Hide resolved
"""Tests the load method for a QuantumCircuit raises a QiskitError,
if the wrong type of arguments were passed."""

theta = Parameter("θ")
angle = np.tensor("some_string_instead_of_an_angle", requires_grad=False)

qc = QuantumCircuit(3, 1)
qc.rz(theta, [0])

quantum_circuit = load(qc)

with pytest.raises(QiskitError):
with recorder:
quantum_circuit(params={theta: angle})

def test_quantum_circuit_error_passing_parameters_not_required(self, recorder):
"""Tests the load method raises a QiskitError if arguments
Expand Down
Loading