python - Code runs while unit testing -
i'm trying unit test minesweeper game made in python. starting small 1 test on 1 definition, runs entire code of should testing minor part. unit testing code:
import unittest minesweeper import setupgrid class testmyfunctions(unittest.testcase): def test_setup(self): self.asserttrue(setupgrid(9, [], 10)) if __name__ == '__main__' : unittest.main(exit=false)
and function should checking:
import random, re, time string import ascii_lowercase def setupgrid(gridsize, start, numberofmines): emptygrid = [['0' in range(gridsize)] in range(gridsize)] mines = getmines(emptygrid, start, numberofmines) i, j in mines: emptygrid[i][j] = 'x' grid = getnumbers(emptygrid) return (grid, mines)
the default values emptygrid , numberofmines are, respectively, 9 , 10 , value start should empty, hence [].
Comments
Post a Comment