Esempio n. 1
0
def test_fill_empty_hand():
    tiles_for_hand = [
        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_hand)
    hand = Hand([])
    hand.fill_from(bag)
    assert len(hand.tiles) == hand.CAPACITY
    assert not bag.tiles
Esempio n. 2
0
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