def test_merge_operations_nothing_to_merge():

    def fail_if_called_func(*_):
        assert False
    c = cirq.Circuit()
    assert (cirq.merge_operations(c, fail_if_called_func) == c)
    q = cirq.LineQubit.range(3)
    c += cirq.Moment(cirq.CZ(*q[:2]))
    assert (cirq.merge_operations(c, fail_if_called_func) == c)
    c += cirq.Moment(cirq.X(q[2]), cirq.global_phase_operation(1j))
    assert (cirq.merge_operations(c, fail_if_called_func) == c)
def test_merge_operations_nothing_to_merge():

    def fail_if_called_func(*_):
        assert False
    c = cirq.Circuit()
    assert (cirq.merge_operations(c, fail_if_called_func) == c)
    q = cirq.LineQubit.range(3)
    c += cirq.Moment(cirq.CZ(*q[:2]))
    assert (cirq.merge_operations(c, fail_if_called_func) == c)
    c += cirq.Moment(cirq.X(q[2]), cirq.global_phase_operation(1j))
    assert (cirq.merge_operations(c, fail_if_called_func) == c)