Exemple #1
0
 def test_vertical_board(self):
     self.assertEqual(create_chessboard(5, 1),
                      [['.'],
                       ['*'],
                       ['.'],
                       ['*'],
                       ['.']])
def test_create_chessboard(size, capfd):
    create_chessboard(size)
    actual = capfd.readouterr()[0]
    expected = dedent(expected_outputs[size])
    assert (_non_empty_lines(actual) ==
            _non_empty_lines(expected))
Exemple #3
0
 def test_one_element_board(self):
     self.assertEqual(create_chessboard(1, 1),
                      [['.']])
Exemple #4
0
 def test_empty_board(self):
     self.assertEqual(create_chessboard(0, 0),
                      [])
Exemple #5
0
 def test_typical_board(self):
     self.assertEqual(create_chessboard(3, 4),
                      [['.', '*', '.', '*'],
                       ['*', '.', '*', '.'],
                       ['.', '*', '.', '*']])
Exemple #6
0
 def test_horizontal_board(self):
     self.assertEqual(create_chessboard(1, 5),
                      [['.', '*', '.', '*', '.']])