def generate_operator(begin, end):
    """Returns a sum of Z operators at qubit [begin, end)."""
    operator = QubitOperator.zero()
    for i in range(begin, end):
        operator += QubitOperator(((i, 'Z'), ), 1)
    return operator
def test_get_operator_groups_empty():
    """Tests get_operator_groups() with zero operator."""
    operator = QubitOperator.zero()

    operators = list(operator.get_operator_groups(1))
    assert operators == []