# Path: tests/case_board.py
# class BoardTestCase(unittest.TestCase):
#     def setUp(self):
#         import chess
#         chess.config = {
#             "slot_0_ip": "",
#             "slot_0_port": 50100,
#             "slot_1_ip": "",
#             "slot_1_port": 50200,
#             "update_frequency": 10,
#             "max_move_time": 5.9,
#             "max_infractions": 5
#         }
# 
# Path: tests/helpers.py
# def C(pos):
#     row = int(pos[1]) - 1
#     col = POS[pos[0]]
#     return row, col
# 
# WHITE = 1
# 
# BLACK = -1
# 
# NONE = 0


import unittest
from .case_board import BoardTestCase
from .helpers import C, WHITE, BLACK, NONE
        from chess.models import Board


def stub_tie_position(board):
    piece = board[C('e5')]
    if piece is not None:
        return True

    return False

class TestBoardTie(BoardTestCase):
    def get_board(self, *args, **kwargs):
        return Board(*args, **kwargs)

    def test_notie(self):
        config = '........' + \
                 '........' + \
                 '....p...' + \
                 '........' + \
                 '........' + \
                 '....P...' + \
                 '........' + \
                 '........' 
        board = self.get_board(config)
        board.tie_methods = [stub_tie_position]

        self.assertFalse(board.draw)

# Path: tests/case_board.py
# class BoardTestCase(unittest.TestCase):
#     def setUp(self):
#         import chess
#         chess.config = {
#             "slot_0_ip": "",
#             "slot_0_port": 50100,
#             "slot_1_ip": "",
#             "slot_1_port": 50200,
#             "update_frequency": 10,
#             "max_move_time": 5.9,
#             "max_infractions": 5
#         }
# 
# Path: tests/helpers.py
# def C(pos):
#     row = int(pos[1]) - 1
#     col = POS[pos[0]]
#     return row, col
# 
# WHITE = 1
# 
# BLACK = -1
# 
# NONE = 0


# Path: tests/test_board_tie.py
import unittest
from .case_board import BoardTestCase
from .helpers import C, WHITE, BLACK, NONE
        from chess.models import Board



def stub_tie_position(board):
    piece = board[C('e5')]
    if piece is not None:
        return True

    return False

class TestBoardTie(BoardTestCase):
    def get_board(self, *args, **kwargs):
        return Board(*args, **kwargs)

    def test_notie(self):
        config = '........' + \
                 '........' + \
                 '....p...' + \
                 '........' + \
                 '........' + \
                 '....P...' + \
                 '........' + \
                 '........' 
        board = self.get_board(config)
        board.tie_methods = [stub_tie_position]

        self.assertFalse(board.draw)

        board.move(C('e3'), C('e4'))