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

Qiskit v0.20 #101

Merged
merged 3 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qiskit>=0.19.1
qiskit>=0.20
pennylane>=0.9.0
numpy
networkx>=2.2;python_version>'3.5'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
long_description = fh.read()

requirements = [
"qiskit>=0.19.1",
"qiskit>=0.20",
"pennylane>=0.9.0",
"numpy",
"networkx>=2.2;python_version>'3.5'",
Expand Down
11 changes: 1 addition & 10 deletions tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,14 +761,8 @@ class TestConverterQasm:
'x q[2];' \
'barrier q;' \
'h q[0];' \
'cu1(pi/2) q[1],q[0];' \
'h q[1];' \
'cu1(pi/4) q[2],q[0];' \
'cu1(pi/2) q[2],q[1];' \
'h q[2];' \
'cu1(pi/8) q[3],q[0];' \
'cu1(pi/4) q[3],q[1];' \
'cu1(pi/2) q[3],q[2];' \
'h q[3];' \
'measure q -> c;'

Expand Down Expand Up @@ -812,16 +806,13 @@ def test_qasm_from_file(self, tmpdir, recorder):
assert recorder.queue[5].parameters == []
assert recorder.queue[5].wires == Wires([3])

assert len(record) == 11
assert len(record) == 5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I recall that the CU1Gate was added at the time because it was the only gate that lacked the to_matrix method. Hence it couldn't be converted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! So it turns out the test was failing because the converter now works automatically for the CU1 gate 😆

# check that the message matches
assert record[0].message.args[0] == "pennylane_qiskit.converter: The {} instruction is not supported by" \
" PennyLane, and has not been added to the template."\
.format('Barrier')
assert record[1].message.args[0] == "pennylane_qiskit.converter: The {} instruction is not supported by" \
" PennyLane, and has not been added to the template."\
.format('CU1Gate')
assert record[7].message.args[0] == "pennylane_qiskit.converter: The {} instruction is not supported by" \
" PennyLane, and has not been added to the template."\
.format('Measure')

def test_qasm_file_not_found_error(self):
Expand Down
6 changes: 4 additions & 2 deletions tests/test_ibmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ def test_load_from_disk(token):
IBMQ.delete_account()


def test_account_error():
def test_account_error(monkeypatch):

# Token is passed such that the test is skipped if no token was provided
with pytest.raises(IBMQAccountError, match="No active IBM Q account"):
IBMQDevice(wires=1)
with monkeypatch.context() as m:
m.delenv("IBMQX_TOKEN", raising=False)
IBMQDevice(wires=1)
Comment on lines +121 to +123
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉



@pytest.mark.parametrize("analytic", [False])
Expand Down