From 2a0b506e9c1745b9976b31e7a273b4fd9c1f6fe8 Mon Sep 17 00:00:00 2001 From: Nate Thompson Date: Sun, 28 Nov 2021 02:04:38 +0000 Subject: [PATCH] Fix CI issues. --- .../cirq/circuits/circuit_operation_test.py | 2 +- cirq-core/cirq/circuits/circuit_test.py | 30 +++++++++---------- cirq-core/cirq/testing/circuit_compare.py | 5 +--- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/cirq-core/cirq/circuits/circuit_operation_test.py b/cirq-core/cirq/circuits/circuit_operation_test.py index cccc520c2a78..6574e45e4b04 100644 --- a/cirq-core/cirq/circuits/circuit_operation_test.py +++ b/cirq-core/cirq/circuits/circuit_operation_test.py @@ -321,7 +321,7 @@ def test_string_format(): fc0 = cirq.FrozenCircuit() op0 = cirq.CircuitOperation(fc0) - assert (str(op0) == f"[ ]") + assert str(op0) == f"[ ]" fc0_global_phase_inner = cirq.FrozenCircuit( cirq.GlobalPhaseOperation(1j), cirq.GlobalPhaseOperation(1j) diff --git a/cirq-core/cirq/circuits/circuit_test.py b/cirq-core/cirq/circuits/circuit_test.py index 13b30675f9e7..bc41f88e7ebe 100644 --- a/cirq-core/cirq/circuits/circuit_test.py +++ b/cirq-core/cirq/circuits/circuit_test.py @@ -392,14 +392,13 @@ def test_control_key_diagram_subcircuit(): cirq.testing.assert_has_diagram( c, """ - Circuit_0xfba37d11898c0e81: - [ 0: ───M─────── ] -0: ───[ ║ ]─── - [ 1: ───╫───X─── ] - [ ║ ║ ] - [ a: ═══@═══^═══ ] + [ 0: ───M─────── ] + [ ║ ] +0: ───[ 1: ───╫───X─── ]─── + [ ║ ║ ] + [ a: ═══@═══^═══ ] │ -1: ───#2──────────────────────────── +1: ───#2─────────────────── """, use_unicode_characters=True, ) @@ -418,16 +417,15 @@ def test_control_key_diagram_subcircuit_layered(): cirq.testing.assert_has_diagram( c, """ - Circuit_0xa3bc42bd21c25cca: - [ 0: ───M─────── ] -0: ───M───[ ║ ]─────── - ║ [ 1: ───╫───X─── ] - ║ [ ║ ║ ] - ║ [ a: ═══@═══^═══ ] + [ 0: ───M─────── ] + [ ║ ]─────── +0: ───M───[ 1: ───╫───X─── ] + ║ [ ║ ║ ] + ║ [ a: ═══@═══^═══ ] ║ ║ -1: ───╫───#2────────────────────────────X─── - ║ ║ ║ -a: ═══@═══╩═════════════════════════════^═══ +1: ───╫───#2───────────────────X─── + ║ ║ ║ +a: ═══@═══╩════════════════════^═══ """, use_unicode_characters=True, ) diff --git a/cirq-core/cirq/testing/circuit_compare.py b/cirq-core/cirq/testing/circuit_compare.py index a282372ff2d9..e3b7236d9e84 100644 --- a/cirq-core/cirq/testing/circuit_compare.py +++ b/cirq-core/cirq/testing/circuit_compare.py @@ -238,10 +238,7 @@ def assert_has_diagram( actual_diagram = actual.to_text_diagram(**kwargs).lstrip("\n").rstrip() desired_diagram = desired.lstrip("\n").rstrip() - def remove_subcircuit_labels(s: str): - return ''.join(line for line in s.splitlines() if 'Circuit_0x' not in line) - - assert remove_subcircuit_labels(actual_diagram) == remove_subcircuit_labels(desired_diagram), ( + assert actual_diagram == desired_diagram, ( "Circuit's text diagram differs from the desired diagram.\n" '\n' 'Diagram of actual circuit:\n'