def hands_from_text(text): p1_cards = text[:14] p2_cards = text[15:].strip() logger.debug(f"cards: {p1_cards}/{p2_cards}") return ( Hand.from_string(p1_cards), # use strip() to remove he newline (if present) Hand.from_string(p2_cards), )
def test_high_card_not_in_rank_comparison(self, cards1, cards2): h1 = Hand.from_string(cards1) h2 = Hand.from_string(cards2) assert h2 > h1
def test_rank(self, cards, rank): hand = Hand.from_string(cards) assert hand.rank == rank
def test_sorting(self): hand = Hand.from_string("2H 5H 4H 3H 6H") assert [6, 5, 4, 3, 2] == [c.value.value for c in hand.cards]