コード例 #1
0
def test_calculate_horizontal_win_returns_false():
    bingo_board = BingoBoard(board=[[
        BingoBoardNumber(value=67, marked=True),
        BingoBoardNumber(value=97)
    ], [BingoBoardNumber(value=47, marked=True),
        BingoBoardNumber(value=15)]])

    result = bingo_board._calculate_horizontal_win()

    assert result is False
コード例 #2
0
def test_get_sum_of_all_unmarked_numbers():
    bingo_board = BingoBoard(board=[[
        BingoBoardNumber(
            value=67), BingoBoardNumber(value=97)
    ], [BingoBoardNumber(value=47),
        BingoBoardNumber(value=15, marked=True)]])

    expected = 67 + 97 + 47

    result = bingo_board.get_sum_of_all_unmarked_numbers()

    assert result == expected
コード例 #3
0
def test_parse_string_into_board():
    board_str = '''67 97
47 15'''

    expected = BingoBoard(
        board=[[BingoBoardNumber(
            value=67), BingoBoardNumber(value=97)],
               [BingoBoardNumber(value=47),
                BingoBoardNumber(value=15)]])

    result: BingoBoard = BingoBoardGenerator.parse_string_into_board(board_str)

    assert result == expected
コード例 #4
0
def test_mark_number():
    bingo_board = BingoBoard(
        board=[[BingoBoardNumber(
            value=67), BingoBoardNumber(value=97)],
               [BingoBoardNumber(value=47),
                BingoBoardNumber(value=15)]])

    expected_board = BingoBoard(board=[[
        BingoBoardNumber(
            value=67), BingoBoardNumber(value=97)
    ], [BingoBoardNumber(value=47),
        BingoBoardNumber(value=15, marked=True)]])

    bingo_board.mark_number(15)

    assert bingo_board == expected_board
コード例 #5
0
def test_parse_string_into_boards():
    boards_str = '''67 97
47 15

44 11
66  7'''

    expected = [
        BingoBoard(
            board=[[BingoBoardNumber(value=67),
                    BingoBoardNumber(value=97)],
                   [BingoBoardNumber(value=47),
                    BingoBoardNumber(value=15)]]),
        BingoBoard(
            board=[[BingoBoardNumber(value=44),
                    BingoBoardNumber(value=11)],
                   [BingoBoardNumber(value=66),
                    BingoBoardNumber(value=7)]])
    ]

    result: List[BingoBoard] = BingoBoardGenerator.parse_string_into_boards(
        boards_str)

    assert result == expected