Exemplo n.º 1
0
 def test_bad_format(self):
     s = SudokuPuzzle([['A', 'B', 'C', 'D'],
                       ['C', 'D', 'A', 'B'],
                       ['B', 'A', '', ''],
                       ['D', 'C', '', '']])
     with self.assertRaises(ValueError):
         s.move('2 2 C')
Exemplo n.º 2
0
 def test_invalid_move(self):
     s = SudokuPuzzle([['A', 'B', 'C', 'D'],
                       ['C', 'D', 'A', 'B'],
                       ['B', 'A', '', ''],
                       ['D', 'C', '', '']])
     with self.assertRaises(ValueError):
         s.move('(2, 2) -> C')
Exemplo n.º 3
0
 def test_sample(self):
     s = SudokuPuzzle([['A', 'B', 'C', 'D'], ['C', 'D', 'A', 'B'],
                       ['B', 'A', '', ''], ['D', 'C', '', '']])
     new_s = s.move('(2, 2) -> D')
     s1 = SudokuPuzzle([['A', 'B', 'C', 'D'], ['C', 'D', 'A', 'B'],
                        ['B', 'A', 'D', ''], ['D', 'C', '', '']])
     self.assertEqual(str(new_s), str(s1))
Exemplo n.º 4
0
 def test_sample(self):
     s = SudokuPuzzle([['A', 'B', 'C', 'D'],
                       ['C', 'D', 'A', 'B'],
                       ['B', 'A', '', ''],
                       ['D', 'C', '', '']])
     new_s = s.move('(2, 2) -> D')
     s1 = SudokuPuzzle([['A', 'B', 'C', 'D'],
                        ['C', 'D', 'A', 'B'],
                        ['B', 'A', 'D', ''],
                        ['D', 'C', '', '']])
     self.assertEqual(str(new_s), str(s1))
Exemplo n.º 5
0
 def test_bad_format(self):
     s = SudokuPuzzle([['A', 'B', 'C', 'D'], ['C', 'D', 'A', 'B'],
                       ['B', 'A', '', ''], ['D', 'C', '', '']])
     with self.assertRaises(ValueError):
         s.move('2 2 C')
Exemplo n.º 6
0
 def test_invalid_move(self):
     s = SudokuPuzzle([['A', 'B', 'C', 'D'], ['C', 'D', 'A', 'B'],
                       ['B', 'A', '', ''], ['D', 'C', '', '']])
     with self.assertRaises(ValueError):
         s.move('(2, 2) -> C')