def test_insertPawn_makeRoom(self): """ When pawns are inserted, a space should be made for them. For now, make a space on all sides. Later, this could change. """ board = Board() board.generate(5,5) locs = map2coord([ 'x x', ' ', ' x ', ' ', 'x x', ]) pawns = [] for loc in locs: pawns.append(Pawn()) board.insertPawn(loc, pawns[-1]) expected_empty = map2coord([ 'xx xx', 'x x x', ' xxx ', 'x x x', 'xx xx', ]) actual_empty = set() for k,v in board.fg_tiles.items(): if v == EMPTY: actual_empty.add(k) self.assertCoordsEqual(expected_empty, actual_empty, "Expected empty tiles to be thus")
def test_insertPawn(self): """ You can put a pawn on the board (and into the game) """ pawn = Pawn() board = Board() board.generate(1,1) board.insertPawn((0,0), pawn) self.assertEqual(pawn.board, board, "Pawn should know " "he's on the board.") self.assertEqual(pawn.loc, (0,0), "Pawn should know where" " he is on the board") self.assertTrue(pawn in board.pawns, "Board should know " "about the Pawn")