Example #1
0
def lastElement (lst):
    """
    Retorna el último elemento de la lista, sin eliminarlo.
    """
    if (lst['type']=='ARRAY_LIST'):
        return alt.lastElement(lst)
    else:
        return slt.lastElement(lst)
def test_addLast(lst, books):
    assert slt.isEmpty(lst) == True
    assert slt.size(lst) == 0
    slt.addLast(lst, books[1])
    assert slt.size(lst) == 1
    slt.addLast(lst, books[2])
    assert slt.size(lst) == 2
    book = slt.firstElement(lst)
    assert book == books[1]
    book = slt.lastElement(lst)
    assert book == books[2]
Example #3
0
def test_addLast(lst, peliculas):
    assert slt.isEmpty(lst) == True
    assert slt.size(lst) == 0
    slt.addLast(lst, peliculas[1])
    assert slt.size(lst) == 1
    slt.addLast(lst, peliculas[2])
    assert slt.size(lst) == 2
    pelicula = slt.firstElement(lst)
    assert pelicula == peliculas[1]
    pelicula = slt.lastElement(lst)
    assert pelicula == peliculas[2]
def test_addLast(lst, books):
    assert lts.isEmpty(lst) == True
    assert lts.size(lst) == 0
    lts.addLast(lst, books[1])
    assert lts.size(lst) == 1
    lts.addLast(lst, books[2])
    assert lts.size(lst) == 2
    book = lts.firstElement(lst)
    assert book == books[1]
    book = lts.lastElement(lst)
    assert book == books[2]
Example #5
0
def lastElement(lst):
    """
    Retorna el último elemento de la lista, sin eliminarlo.
    Args:
        lst
            Lista a evaluar
    Return::int
        El último elemento dentro de la lista
    """
    if (lst['type'] == 'ARRAY_LIST'):
        return alt.lastElement(lst)
    else:
        return slt.lastElement(lst)
Example #6
0
def lastElement(lst):
    """ Retorna el último elemento de una  lista no vacia.  No se elimina el elemento.

    Args:
        lst: La lista a examinar

    Raises:
        Exception
    """
    try:
        if (lst['type'] == 'ARRAY_LIST'):
            return alt.lastElement(lst)
        else:
            return slt.lastElement(lst)
    except Exception as exp:
        error.reraise(exp, 'List->lastElement: ')