-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add test for the add_dd_and_align_right in 2D GHZ state generation #7793
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7793 +/- ##
=======================================
Coverage 99.57% 99.57%
=======================================
Files 1102 1102
Lines 98434 98449 +15
=======================================
+ Hits 98014 98029 +15
Misses 420 420 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
LGTM % @pavoljuhas 's review |
| with mock.patch('cirq.transformers.add_dynamical_decoupling') as mock_dd: | ||
| mock_dd.return_value = cirq.Circuit() |
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.
Can you please rewrite this test without mocking?
For example, you could compare the circuits produced with and without the dynamical decoupling and check that the extra operations added by the dd have expected gate kinds.
pavoljuhas
left a comment
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.
Let us avoid mocking in the new test. Applying some rudimentary check for what is added by the DD would be fine.
On another page - can you please apply the patch below?
The code does the same, but I found it confusing as to how is the lambda and list comprehension expanded.
diff --git a/cirq-core/cirq/experiments/ghz_2d.py b/cirq-core/cirq/experiments/ghz_2d.py
index 48394af6..2d884c3f 100644
--- a/cirq-core/cirq/experiments/ghz_2d.py
+++ b/cirq-core/cirq/experiments/ghz_2d.py
@@ -52,3 +52,7 @@ def _transform_circuit(circuit: circuits.Circuit) -> circuits.Circuit:
circuit = transformers.stratified_circuit(
- circuit[::-1], categories=[lambda op: protocols.num_qubits(op) == k for k in (1, 2)]
+ circuit[::-1],
+ categories=[
+ lambda op: protocols.num_qubits(op) == 1,
+ lambda op: protocols.num_qubits(op) == 2,
+ ],
)[::-1]
Fix #7784