Example #1
0
 def __init__(self, **kwargs):
     BoardItem.__init__(self, **kwargs)
     if "step" not in kwargs.keys():
         self.step = 1
     else:
         self.step = kwargs["step"]
     self._overlapping = None
     self._overlapping_buffer = None
Example #2
0
 def test_create_custom_boardItem(self):
     self.boardItem = BoardItem(
         name="test_boardItem", type="test_type", pos=[10, 10], model="test_model"
     )
     self.assertEqual(self.boardItem.name, "test_boardItem")
     self.assertEqual(self.boardItem.type, "test_type")
     self.assertEqual(self.boardItem.pos, [10, 10])
     self.assertEqual(self.boardItem.model, "test_model")
Example #3
0
 def test_create_custom_boardItem(self):
     self.boardItem = BoardItem(name='test_boardItem',
                                type='test_type',
                                pos=[10, 10],
                                model='test_model')
     self.assertEqual(self.boardItem.name, 'test_boardItem')
     self.assertEqual(self.boardItem.type, 'test_type')
     self.assertEqual(self.boardItem.pos, [10, 10])
     self.assertEqual(self.boardItem.model, 'test_model')
Example #4
0
    def test_clear_cell(self):
        self.board = Board(name="test_board",
                           size=[10, 10],
                           player_starting_position=[5, 5])
        self.placed_item = BoardItem()
        self.board.place_item(item=self.placed_item, row=1, column=1)
        self.assertIsInstance(self.board.item(1, 1), BoardItem)

        self.board.clear_cell(1, 1)
        self.assertIsInstance(self.board.item(1, 1), BoardItemVoid)
Example #5
0
    def test_item(self):
        self.board = Board(name="test_board",
                           size=[10, 10],
                           player_starting_position=[5, 5])
        self.placed_item = BoardItem()

        self.board.place_item(self.placed_item, 1, 1)
        self.returned_item = self.board.item(1, 1)
        self.assertEqual(self.placed_item, self.returned_item)

        with self.assertRaises(HacOutOfBoardBoundException) as excinfo:
            self.board.item(15, 15)
        self.assertTrue(
            "out of the board boundaries" in str(excinfo.exception))
Example #6
0
 def __init__(self, **kwargs):
     BoardItem.__init__(self, **kwargs)
     if 'size' not in kwargs.keys():
         self._size = 0
     else:
         self._size = kwargs['size']
Example #7
0
 def __init__(self, **kwargs):
     BoardItem.__init__(self, **kwargs)
     if "size" not in kwargs.keys():
         self._size = 0
     else:
         self._size = kwargs["size"]
Example #8
0
 def test_create_default_boardItem(self):
     self.boardItem = BoardItem()
     self.assertEqual(self.boardItem.name, 'Board item')
     self.assertEqual(self.boardItem.type, 'item')
     self.assertEqual(self.boardItem.pos, [None, None])
     self.assertEqual(self.boardItem.model, '*')