# 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

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

    def test_empty(self):
        board = self.get_board()

        for row in xrange(8):
            for col in xrange(8):
                piece = board[(row, col)]
                self.assertEqual(piece, None)

    def test_pawnbattle(self):
        config = 'r......rpppppppp................................PPPPPPPPR......R'
        board = self.get_board(config)

        i = 0
        for row in xrange(7, -1, -1):
            for col in xrange(0, 8):
                piece = board[(row, col)]

                if config[i] == '.':
                    self.assertEqual(piece, None)
                else:
                    self.assertEqual(piece.repr, config[i])


# 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_construction.py
import unittest
from .case_board import BoardTestCase
from .helpers import C, WHITE, BLACK
        from chess.models import Board


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

    def test_empty(self):
        board = self.get_board()

        for row in xrange(8):
            for col in xrange(8):
                piece = board[(row, col)]
                self.assertEqual(piece, None)

    def test_pawnbattle(self):
        config = 'r......rpppppppp................................PPPPPPPPR......R'
        board = self.get_board(config)

        i = 0
        for row in xrange(7, -1, -1):
            for col in xrange(0, 8):
                piece = board[(row, col)]

                if config[i] == '.':
                    self.assertEqual(piece, None)
                else:
                    self.assertEqual(piece.repr, config[i])


                i += 1