def test_lay_regression1(): """Set iterator should not return duplicates.""" h = Hand() cards = [ Card(2, Color.CLUB), Card(2, Color.HEART), Card(2, Color.DIAMOND), Card(5, Color.SPADE), Card(5, Color.HEART), Card(Rank.KING, Color.DIAMOND), Card.JOKER, Card.JOKER, Card.JOKER, Card.JOKER, ] for card in cards: h.put_card(card) objective = Objective(3, 0) # if set iterator returns dupes, this will be ~= 780 assert len(list(h.iter_melds(objective))) == 39
from liverpool.common import Card, Color, Objective from liverpool.hand import Hand h = Hand() h.put_card(Card(7, Color.SPADE)) h.put_card(Card(7, Color.DIAMOND)) h.put_card(Card(7, Color.HEART)) h.put_card(Card(2, Color.HEART)) h.put_card(Card(3, Color.HEART)) h.put_card(Card(3, Color.CLUB)) h.put_card(Card.JOKER) h.put_card(Card(4, Color.HEART)) h.put_card(Card(5, Color.HEART)) print() print('Sets:') for set_ in h.iter_sets(): print(set_) print() print('Runs:') for run in h.iter_runs(): print(run) objective = Objective(1, 1) print() print('1/1 Melds:') for lay in h.iter_melds(objective): print(lay)