1
This gives error when running def test() to test def questao(). Why would be giving error in the return of the test function?
def questao():
    lista_nomes = []
    nome = ''       
    x = 0    
    reader = csv.DictReader(arquivo)
    for linha in reader:
        nome = linha['full_name']        
        lista_nomes.append(nome)
        x += 1
        if  x == 20:
            break
    return lista_nomes
Testing
def teste():
    r = questao()
    assert (
        isinstance(r, list) and
        all(isinstance(y, str) for y in r)
    )
Error below:
C:\Users\perei\devpy\python-1\teste.py:25: AssertionError: assert [] == ['C. Ronaldo'..., 'Robert Pererira', ...]
By the looks of it you have two types of test, the first to know if
ris a list and another to know if each item on the list has strings. I would sort out these tests, something likeassert isinstance(r, list) == Trueandassert all(isinstance(y, str) for y in r) == Truebecause they are different validations.– Giovanni Nunes