lundi 22 février 2021

Issues with unit testing

I want to test a function, but I am definitely struggling at this one. The function loops through boards last row if NO_PLayer is valid location.

def validLocations(board):

    validLocationsArr = []

    column = 0
    row = 0
    while column < 6:

        if (board[5][column] == NO_PLAYER):
                validLocationsArr.append(column)

        column += 1

    return validLocationsArr

I worked on it, and tried it, but:

def test_validLocations(self):
    from agents.common import validLocations

    ret = validLocations(board)
    assert np.all(ret == NO_PLAYER)

Can anyone help me? Many thanks in advance!

Aucun commentaire:

Enregistrer un commentaire