Exemple #1
0
 def test_rows(self):
     #test BoardBlock correctly returns its rows
     test_squares1 = OrderedDict(( ((0,0),[2]),
                                   ((0,1),[1,9]),
                                   ((0,2),[1,5,9]),
                                   ((1,0),[3]),
                                   ((1,1),[8]),
                                   ((1,2),[6]),
                                   ((2,0),[4]),
                                   ((2,1),[7]),
                                   ((2,2),[1,5,9]) ) )
     test_block1 = BoardBlock(test_squares1)
     test_row1 = ((((0,0),[2]),((0,1),[1,9]),((0,2),[1,5,9])))
     test_row2 = ((((1,0),[3]),((1,1),[8]),((1,2),[6])))
     test_row3 = ((((2,0),[4]),((2,1),[7]),((2,2),[1,5,9])))
     self.assertEqual(test_block1.rows(), (test_row1, test_row2, test_row3))
Exemple #2
0
 def test_group(self):
     #group()
     
     test_squares1 = OrderedDict(( ((0,0),[2]),
                                   ((0,1),[1,9]),
                                   ((0,2),[1,5,9]),
                                   ((1,0),[3]),
                                   ((1,1),[8]),
                                   ((1,2),[1,5,6,9]),
                                   ((2,0),[4]),
                                   ((2,1),[7]),
                                   ((2,2),[1,5,9]) ) )
     test_group1 = [ [2], [1,9], [1,5,9], [3], [8], [1,5,6,9], [4], [7], [1,5,9], ]
     test_block1 = BoardBlock(test_squares1)
     
     self.assertEqual(test_group1, test_block1.group())
Exemple #3
0
 def test_update_squares_from_group(self):
     #update_squares_from_group()
     
     test_group2 = [[2], [1, 9], [1, 5, 9], [3], [8], [6], [4], [7], [1, 5, 9]]
     test_squares2 = OrderedDict(( ((0,0),[2]),
                                   ((0,1),[1,9]),
                                   ((0,2),[1,5,9]),
                                   ((1,0),[3]),
                                   ((1,1),[8]),
                                   ((1,2),[1,5,6,9]),
                                   ((2,0),[4]),
                                   ((2,1),[7]),
                                   ((2,2),[1,5,9]) ) )
     test_squares3 = OrderedDict(( ((0,0),[2]),
                                   ((0,1),[1,9]),
                                   ((0,2),[1,5,9]),
                                   ((1,0),[3]),
                                   ((1,1),[8]),
                                   ((1,2),[6]),
                                   ((2,0),[4]),
                                   ((2,1),[7]),
                                   ((2,2),[1,5,9]) ) )
     test_block2 = BoardBlock(test_squares2)
     self.assertEqual(test_squares3, test_block2.update_squares_from_group(test_group2))