mirror of
https://codeberg.org/cblanken/boggler.git
synced 2026-07-26 03:29:26 -04:00
Initial blacken reformat
This commit is contained in:
@@ -4,19 +4,22 @@ from boggler.boggler_utils import read_boggle_file, BadBoardFormat
|
||||
|
||||
boards_path = Path(Path(__file__).parent.resolve())
|
||||
|
||||
|
||||
@pytest.fixture(name="expected_board_4x4")
|
||||
def fixture_expected_board_4x4():
|
||||
return [
|
||||
['u', 'n', 'r', 'e'],
|
||||
['qu', 'n', 'i', 'l'],
|
||||
['i', 's', 'h', 'a'],
|
||||
['s', 'e', 'l', 'b']
|
||||
["u", "n", "r", "e"],
|
||||
["qu", "n", "i", "l"],
|
||||
["i", "s", "h", "a"],
|
||||
["s", "e", "l", "b"],
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture(name="clean_4x4_path")
|
||||
def fixture_clean_4x4_path():
|
||||
return Path(boards_path, "./boards/4x4_clean.board")
|
||||
|
||||
|
||||
def test_clean_4x4_board(expected_board_4x4, clean_4x4_path):
|
||||
"""Test 4x4 board with clean input"""
|
||||
assert expected_board_4x4 == read_boggle_file(clean_4x4_path)
|
||||
@@ -27,6 +30,7 @@ def test_clean_4x4_board(expected_board_4x4, clean_4x4_path):
|
||||
def fixture_leading_whitespace_4x4_path():
|
||||
return Path(boards_path, "./boards/4x4_leading_whitespace.board")
|
||||
|
||||
|
||||
def test_leading_whitespace_4x4_board(expected_board_4x4, leading_whitespace_4x4_path):
|
||||
"""Test 4x4 board with leading whitepace in rows"""
|
||||
assert expected_board_4x4 == read_boggle_file(leading_whitespace_4x4_path)
|
||||
@@ -37,6 +41,7 @@ def test_leading_whitespace_4x4_board(expected_board_4x4, leading_whitespace_4x4
|
||||
def fixture_between_whitespace_4x4_path():
|
||||
return Path(boards_path, "./boards/4x4_between_whitespace.board")
|
||||
|
||||
|
||||
def test_between_whitespace_4x4_board(expected_board_4x4, between_whitespace_4x4_path):
|
||||
"""Test 4x4 board with whitespace surrounding letters in block"""
|
||||
assert expected_board_4x4 == read_boggle_file(between_whitespace_4x4_path)
|
||||
@@ -47,7 +52,10 @@ def test_between_whitespace_4x4_board(expected_board_4x4, between_whitespace_4x4
|
||||
def fixture_trailing_whitespace_4x4_path():
|
||||
return Path(boards_path, "./boards/4x4_trailing_whitespace.board")
|
||||
|
||||
def test_trailing_whitespace_4x4_board(expected_board_4x4, trailing_whitespace_4x4_path):
|
||||
|
||||
def test_trailing_whitespace_4x4_board(
|
||||
expected_board_4x4, trailing_whitespace_4x4_path
|
||||
):
|
||||
"""Test 4x4 board with trailing whitespace in rows"""
|
||||
assert expected_board_4x4 == read_boggle_file(trailing_whitespace_4x4_path)
|
||||
|
||||
@@ -57,6 +65,7 @@ def test_trailing_whitespace_4x4_board(expected_board_4x4, trailing_whitespace_4
|
||||
def fixture_blank_lines_4x4_path():
|
||||
return Path(boards_path, "./boards/4x4_blank_lines.board")
|
||||
|
||||
|
||||
def test_blank_lines_4x4_board(blank_lines_4x4_path):
|
||||
"""Test 4x4 board with blank lines in board file"""
|
||||
with pytest.raises(BadBoardFormat, match="must contain no blank lines"):
|
||||
@@ -68,6 +77,7 @@ def test_blank_lines_4x4_board(blank_lines_4x4_path):
|
||||
def fixture_inconsistent_width_4x4_path():
|
||||
return Path(boards_path, "./boards/4x4_inconsistent_width.board")
|
||||
|
||||
|
||||
def test_inconsistent_width_4x4_board(inconsistent_width_4x4_path):
|
||||
"""Test board with irregular number of blocks per row"""
|
||||
with pytest.raises(BadBoardFormat, match="length of each row must be the same"):
|
||||
|
||||
Reference in New Issue
Block a user