示例#1
0
 def test_eliminate(self):
     loc0 = (0,1)
     eliminate = sudoku.read_sudoku("./data/eliminateTest.txt")    #read the eliminate result
     problem = sudoku.read_sudoku("./data/data1.txt")  #read the puzzle
     problemSets = sudoku.convertToSets(problem)
     listOfLocation = sudoku.getRowLocations(loc0[0]) + sudoku.getColumnLocations(loc0[1]) \
                         + sudoku.getBoxLocations(loc0) 
     self.assertEqual(12, sudoku.eliminate(problemSets, loc0, listOfLocation))
     self.assertEqual(eliminate, problemSets)
示例#2
0
def testGetColumnLocations():
    lst = [(0, 5), (1, 5), (2, 5), (3, 5), (4, 5), (5, 5), (6, 5), (7, 5),
           (8, 5)]
    assert sudoku.getColumnLocations(5) == lst
示例#3
0
def test_col_locations(col_locs, col, col2):
    assert getColumnLocations(col) == col_locs[col2]
示例#4
0
 def test_getColumnLocations(self):
     column0 = [(0, 0), (1, 0), (2, 0), (3, 0), 
                (4, 0), (5, 0), (6, 0), (7, 0), (8, 0)]
     self.assertEqual(column0, sudoku.getColumnLocations(0))