# 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


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

        self.assertEqual(board.who_moves, BLACK)
        
        piece = board[C('h8')]
        board.move(C('h8'), C('h7'))
        self.assertFalse(board.bad_move)
        self.assertEqual(board[C('h7')], piece)
        self.assertEqual(board[C('h8')], None)

        self.assertTrue(enemy_pawn not in board.pieces)
        self.assertTrue(enemy_pawn not in board.black_pieces)


    def test_enpassant_capture(self):
        config = 'r......r' + \
                 'pppp.ppp' + \
                 '........' + \
                 '...Pp...' + \
                 '........' + \
                 '........' + \
                 'PPP.PPPP' + \
                 'R......R' 
        board = self.get_board(config)

        board.enpassant = C('e6')
        board.enpassant_piece = board[C('e5')]

        piece = board[C('d5')]
        board.move(C('d5'), C('e6'))


# 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


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


        self.assertEqual(board.who_moves, BLACK)
        
        piece = board[C('h8')]
        board.move(C('h8'), C('h7'))
        self.assertFalse(board.bad_move)
        self.assertEqual(board[C('h7')], piece)
        self.assertEqual(board[C('h8')], None)

        self.assertTrue(enemy_pawn not in board.pieces)
        self.assertTrue(enemy_pawn not in board.black_pieces)


    def test_enpassant_capture(self):
        config = 'r......r' + \
                 'pppp.ppp' + \
                 '........' + \
                 '...Pp...' + \
                 '........' + \
                 '........' + \
                 'PPP.PPPP' + \
                 'R......R' 
        board = self.get_board(config)

        board.enpassant = C('e6')
        board.enpassant_piece = board[C('e5')]

        piece = board[C('d5')]
        board.move(C('d5'), C('e6'))


        self.assertEqual(board[C('e5')], None)