Skip to content

Conversation

@shashwatk1998
Copy link
Contributor

Fix #7784

@shashwatk1998 shashwatk1998 requested review from a team, mrwojtek and vtomole as code owners December 4, 2025 19:13
@github-actions github-actions bot added the size: S 10< lines changed <50 label Dec 4, 2025
@shashwatk1998
Copy link
Contributor Author

@NoureldinYosri

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.57%. Comparing base (4d75b4b) to head (d6fcdcf).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@NoureldinYosri NoureldinYosri changed the title Ghz2d Add test for the add_dd_and_align_right in 2D GHZ state generation Dec 4, 2025
@NoureldinYosri
Copy link
Collaborator

LGTM % @pavoljuhas 's review

@pavoljuhas pavoljuhas self-assigned this Dec 5, 2025
Comment on lines +170 to +171
with mock.patch('cirq.transformers.add_dynamical_decoupling') as mock_dd:
mock_dd.return_value = cirq.Circuit()
Copy link
Collaborator

@pavoljuhas pavoljuhas Dec 5, 2025

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.

Copy link
Collaborator

@pavoljuhas pavoljuhas left a 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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test for the add_dd_and_align_right in 2D GHZ state generation

3 participants