def test_unroll_circuit_op_and_variants():
    q = cirq.LineQubit.range(2)
    c = cirq.Circuit(cirq.X(q[0]), cirq.CNOT(q[0], q[1]), cirq.X(q[0]))
    cirq.testing.assert_has_diagram(c, '\n0: ───X───@───X───\n          │\n1: ───────X───────\n')
    mapped_circuit = cirq.map_operations(c, (lambda op, i: (([cirq.Z(q[1])] * 2) if (op.gate == cirq.CNOT) else op)))
    cirq.testing.assert_has_diagram(cirq.unroll_circuit_op(mapped_circuit), '\n0: ───X───────────X───\n\n1: ───────Z───Z───────\n')
    cirq.testing.assert_has_diagram(cirq.unroll_circuit_op_greedy_earliest(mapped_circuit), '\n0: ───X───────X───\n\n1: ───Z───Z───────\n')
    cirq.testing.assert_has_diagram(cirq.unroll_circuit_op_greedy_frontier(mapped_circuit), '\n0: ───X───────X───\n\n1: ───────Z───Z───\n')
def test_unroll_circuit_op_and_variants():
    q = cirq.LineQubit.range(2)
    c = cirq.Circuit(cirq.X(q[0]), cirq.CNOT(q[0], q[1]), cirq.X(q[0]))
    cirq.testing.assert_has_diagram(c, '\n0: ───X───@───X───\n          │\n1: ───────X───────\n')
    mapped_circuit = cirq.map_operations(c, (lambda op, i: (([cirq.Z(q[1])] * 2) if (op.gate == cirq.CNOT) else op)))
    cirq.testing.assert_has_diagram(cirq.unroll_circuit_op(mapped_circuit), '\n0: ───X───────────X───\n\n1: ───────Z───Z───────\n')
    cirq.testing.assert_has_diagram(cirq.unroll_circuit_op_greedy_earliest(mapped_circuit), '\n0: ───X───────X───\n\n1: ───Z───Z───────\n')
    cirq.testing.assert_has_diagram(cirq.unroll_circuit_op_greedy_frontier(mapped_circuit), '\n0: ───X───────X───\n\n1: ───────Z───Z───\n')