def test_last_move(): tiles = [Tile(Color.RED, Shape.CLOVER)] hand = Hand(tiles) player1 = Player(hand, [1, 1]) player2 = Player([]) # TODO: Illegal state board = Board([(Position(0, 0), Tile(Color.RED, Shape.DIAMOND))]) bag = Bag([]) game = Game(bag, board, [player2, player1], player1) tiles_and_positions = [(Position(0, 1), Tile(Color.RED, Shape.CLOVER))] game.make_move(tiles_and_positions) assert 2+6+2 == player1.total_score() expected_tiles_on_hand = [] assert set(expected_tiles_on_hand) == set(player1.hand.tiles) assert not bag.tiles assert game.current_player is None
def test_fill_partially_filled_hand(): tiles_in_hand = [ Tile(Color.RED, Shape.CIRCLE), Tile(Color.ORANGE, Shape.X), Tile(Color.YELLOW, Shape.DIAMOND) ] hand = Hand(tiles_in_hand) tiles_for_bag = [ Tile(Color.RED, Shape.CIRCLE), Tile(Color.ORANGE, Shape.X), Tile(Color.YELLOW, Shape.DIAMOND), Tile(Color.GREEN, Shape.SQUARE), Tile(Color.BLUE, Shape.STAR), Tile(Color.PURPLE, Shape.CLOVER), ] bag = Bag(tiles_for_bag) hand.fill_from(bag) assert set(tiles_in_hand) == set(hand.tiles) assert hand.CAPACITY == len(hand.tiles) assert len(bag.tiles) == 3
def test_is_not_empty(): hand = Hand([Tile(Color.RED, Shape.CIRCLE)]) assert not hand.is_empty()
def test_is_empty(): hand = Hand([]) assert hand.is_empty()