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))
def test_one_element_board(self): self.assertEqual(create_chessboard(1, 1), [['.']])
def test_empty_board(self): self.assertEqual(create_chessboard(0, 0), [])
def test_typical_board(self): self.assertEqual(create_chessboard(3, 4), [['.', '*', '.', '*'], ['*', '.', '*', '.'], ['.', '*', '.', '*']])
def test_horizontal_board(self): self.assertEqual(create_chessboard(1, 5), [['.', '*', '.', '*', '.']])