コード例 #1
0
ファイル: test_hand.py プロジェクト: henriksu/qwirkle
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
コード例 #2
0
ファイル: test_hand.py プロジェクト: henriksu/qwirkle
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