-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
"cregbundle set to False" warning should not raised when no classical bits are involved #8689
Conversation
… bits are involved
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 3162371682
💛 - Coveralls |
This PR would be very helpful for the explanation section I'm adding in #8685. |
Would you like to make this part of a slightly larger issue surrounding the |
--- | ||
fixes: | ||
- | | ||
When :func:`~circuit_drawer` was used with `reverse_bits=True` on a circuit without classical bits, warning about `cregbundle` was raised, creating confusion. The warning was removed for this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line could do with wrapping - when reno generates the rst for the metapackage, this goes in at a few levels of nesting that might cause its linter to complain.
(It wouldn't hurt for us to get a checker running on Terra to enforce that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 56d3e38
def test_reverse_bits(self): | ||
"""Test reverse_bits should not raise warnings when no classical qubits: | ||
See: https://github.com/Qiskit/qiskit-terra/pull/8689""" | ||
circuit = QuantumCircuit(3) | ||
circuit.x(1) | ||
|
||
with catch_warnings(): | ||
simplefilter("error") | ||
visualization.circuit_drawer(circuit, reverse_bits=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to test the output of this against the expected one as well, just to be sure.
I think the test suite should automatically fail if the warning is emitted without messing with catch_warnings
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to test the output of this against the expected one as well, just to be sure.
checking the result in 6a1e223
I think the test suite should automatically fail if the warning is emitted without messing with
catch_warnings
?
I dont disagree, but I think we have some warnings around. Maybe for another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the warning missing
I fixed that one too by changing the way that the default is handled for that parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some small doc fixes inline
@Guillermo-Mijares-Vilarino discovered that the following code raises a very confusing warning:
This fix checks if classical bits are involved before touching
cregbundle
.Fixes #8690