From 9217f4ce0835de79f81bd59ebb3beb211fdc23d7 Mon Sep 17 00:00:00 2001 From: Codrut Date: Sun, 1 Jun 2025 11:46:22 +0200 Subject: [PATCH 1/3] Fix test assertion in raw_types_test.py. --- cirq-core/cirq/ops/raw_types_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cirq-core/cirq/ops/raw_types_test.py b/cirq-core/cirq/ops/raw_types_test.py index c4fda0413a3..6fa698e488b 100644 --- a/cirq-core/cirq/ops/raw_types_test.py +++ b/cirq-core/cirq/ops/raw_types_test.py @@ -652,7 +652,7 @@ 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 [*tagged_h._decompose_()] == cirq.decompose_once(h) assert cirq.pauli_expansion(tagged_h) == cirq.pauli_expansion(h) assert cirq.equal_up_to_global_phase(h, tagged_h) assert np.isclose(cirq.kraus(h), cirq.kraus(tagged_h)).all() From 0d6737365623ee50394d7f02b546497deeb4e929 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Wed, 4 Jun 2025 10:41:49 -0700 Subject: [PATCH 2/3] Prefer testing the public `cirq.decompose` API We can verify the call of `decompose_once` via public API. --- cirq-core/cirq/ops/raw_types_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cirq-core/cirq/ops/raw_types_test.py b/cirq-core/cirq/ops/raw_types_test.py index 6fa698e488b..b819ade4845 100644 --- a/cirq-core/cirq/ops/raw_types_test.py +++ b/cirq-core/cirq/ops/raw_types_test.py @@ -651,8 +651,7 @@ 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_once(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) assert np.isclose(cirq.kraus(h), cirq.kraus(tagged_h)).all() From dfd027ed036b14f6fa9332745868e9fd6dbb12e4 Mon Sep 17 00:00:00 2001 From: Pavol Juhas Date: Mon, 23 Jun 2025 00:11:53 -0700 Subject: [PATCH 3/3] Revert "Prefer testing the public `cirq.decompose` API" This reverts commit 0d6737365623ee50394d7f02b546497deeb4e929. --- cirq-core/cirq/ops/raw_types_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cirq-core/cirq/ops/raw_types_test.py b/cirq-core/cirq/ops/raw_types_test.py index b819ade4845..6fa698e488b 100644 --- a/cirq-core/cirq/ops/raw_types_test.py +++ b/cirq-core/cirq/ops/raw_types_test.py @@ -651,7 +651,8 @@ 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_once(h) + assert cirq.decompose(tagged_h) == cirq.decompose(h) + assert [*tagged_h._decompose_()] == cirq.decompose_once(h) assert cirq.pauli_expansion(tagged_h) == cirq.pauli_expansion(h) assert cirq.equal_up_to_global_phase(h, tagged_h) assert np.isclose(cirq.kraus(h), cirq.kraus(tagged_h)).all()