-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7401 +/- ##
==========================================
- Coverage 98.69% 98.69% -0.01%
==========================================
Files 1112 1112
Lines 97754 97753 -1
==========================================
- Hits 96477 96475 -2
- Misses 1277 1278 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 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.
We can verify the call of `decompose_once` via public API.
@codrut3 - I have pushed a small tweak from my comment above - #7401 (review). Please let me know if it is OK with you. LGTM for myself. |
I'm not sure this is correct. My understanding is that cirq.decompose() attempts to recursively decompose using dfs, so it shouldn't be equivalent to a single step of decomposition. On the other hand, the So if you don't want to test
|
This fixes a small issue that I found while working on #7291
TaggedOperation
_decompose_
callsprotocols.decompose_once
(see here). So it must be compared againstcirq.decompose_once
.