Skip to content

Fix test assertion in raw_types_test.py. #7401

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

codrut3
Copy link
Contributor

@codrut3 codrut3 commented Jun 1, 2025

This fixes a small issue that I found while working on #7291

TaggedOperation _decompose_ calls protocols.decompose_once (see here). So it must be compared against cirq.decompose_once.

@codrut3 codrut3 requested review from vtomole and a team as code owners June 1, 2025 10:02
@codrut3 codrut3 requested a review from 95-martin-orion June 1, 2025 10:02
@github-actions github-actions bot added the Size: XS <10 lines changed label Jun 1, 2025
Copy link

codecov bot commented Jun 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.68%. Comparing base (e27d883) to head (9217f4c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7401      +/-   ##
==========================================
- Coverage   98.68%   98.68%   -0.01%     
==========================================
  Files        1112     1112              
  Lines       97709    97709              
==========================================
- Hits        96427    96426       -1     
- Misses       1282     1283       +1     

☔ 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.
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.

I wonder if we should be testing the _decompose_ method directly or rather its effect on the public cirq.decompose API.

How about changing it like this:

diff --git a/cirq-core/cirq/ops/raw_types_test.py b/cirq-core/cirq/ops/raw_types_test.py
index c4fda0413..b819ade48 100644
--- a/cirq-core/cirq/ops/raw_types_test.py
+++ b/cirq-core/cirq/ops/raw_types_test.py
@@ -652,6 +652,5 @@ def test_tagged_operation_forwards_protocols() -> None:
     np.testing.assert_equal(cirq.unitary(tagged_h), cirq.unitary(h))
     assert cirq.has_unitary(tagged_h)
-    assert cirq.decompose(tagged_h) == cirq.decompose(h)
-    assert [*tagged_h._decompose_()] == cirq.decompose(h)
+    assert cirq.decompose(tagged_h) == cirq.decompose_once(h)
     assert cirq.pauli_expansion(tagged_h) == cirq.pauli_expansion(h)
     assert cirq.equal_up_to_global_phase(h, tagged_h)

Otherwise LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: XS <10 lines changed
2 participants