def removeFirst(lst): """ Remueve el primer elemento de la lista """ if (lst['type'] == 'ARRAY_LIST'): alt.removeFirst(lst) else: slt.removeFirst(lst)
def removeFirst(lst): """ Remueve el primer elemento de la lista. Elimina y retorna el primer elemento de la lista. El tamaño de la lista se decrementa en uno. Si la lista es vacía se retorna None. Args: lst: La lista a examinar Raises: Exception """ try: if (lst['type'] == 'ARRAY_LIST'): return alt.removeFirst(lst) else: return slt.removeFirst(lst) except Exception as exp: error.reraise(exp, 'List->removeFirst: ')
def test_removeFirst(lstbooks, books): assert slt.size(lstbooks) == 5 slt.removeFirst(lstbooks) assert slt.size(lstbooks) == 4 book = slt.getElement(lstbooks, 1) assert book == books[1]
def test_removeFirst(lstcasting, casting): assert slt.size(lstcasting) == len(casting) slt.removeFirst(lstcasting) assert slt.size(lstcasting) == len(casting) - 1 cast = slt.getElement(lstcasting, 1) assert cast == casting[1]
def test_removeFirst(lstpeliculas, peliculas): assert slt.size(lstpeliculas) == len(peliculas) slt.removeFirst(lstpeliculas) assert slt.size(lstpeliculas) == len(peliculas) - 1 pelicula = slt.getElement(lstpeliculas, 1) assert pelicula == peliculas[1]