-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix diagram for Identity with no qubits #6926
Conversation
- An IdentityGate with 0 qubits used to raise an exception in the circuit drawer. - This PR fixes the issue and displays the gate similar to a GlobalPhaseGate. Fixes: quantumlib#6768
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6926 +/- ##
=======================================
Coverage 97.86% 97.86%
=======================================
Files 1084 1084
Lines 94309 94314 +5
=======================================
+ Hits 92298 92303 +5
Misses 2011 2011 ☔ View full report in Codecov by Sentry. |
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 without an extra list.
cirq-core/cirq/ops/identity_test.py
Outdated
1: ───I─── | ||
│ | ||
2: ───I─── | ||
""".strip() |
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.
cirq.testing.assert_has_diagram
trims and yada yada for you.
If you want to solve this more broadly, I'm pretty sure the place is here: https://github.com/quantumlib/Cirq/blob/main/cirq-core/cirq/protocols/circuit_diagram_info_protocol.py#L345. Add a check |
Co-authored-by: Pavol Juhas <[email protected]>
…/Cirq-1 into identity_gate_diagram
Fixes: #6768