コード例 #1
0
    def test_returns_pair_from_card_collection(self):
        ten_of_spades = Card(rank="10", suit="Spades")
        ten_of_clubs = Card(rank="10", suit="Clubs")

        cards = [
            Card(rank="3", suit="Hearts"),
            Card(rank="5", suit="Diamonds"), ten_of_spades, ten_of_clubs,
            Card(rank="King", suit="Clubs")
        ]

        validator = PairValidator(cards=cards)

        self.assertEqual(validator.valid_cards(),
                         [ten_of_spades, ten_of_clubs])
コード例 #2
0
    def test_returns_pair_from_card_collection(self):
        ten_of_spades = Card(rank='10', suit='Spades')
        ten_of_clubs = Card(rank='10', suit='Clubs')

        cards = [
            Card(rank='3', suit='Hearts'),
            Card(rank='8', suit='Diamonds'), ten_of_spades, ten_of_clubs,
            Card(rank='Queen', suit='Spades')
        ]

        validator = PairValidator(cards=cards)

        self.assertEqual(validator.valid_cards(),
                         [ten_of_spades, ten_of_clubs])
コード例 #3
0
    def test_valid_cards_making_a_pair(self):

        nine_diamonds = Card(rank="9", suite="diamonds")
        nine_clubs = Card(rank="9", suite="clubs")

        cards = [
            Card(rank="5", suite="hearts"),
            Card(rank="7", suite="spades"), nine_diamonds, nine_clubs,
            Card(rank="King", suite="hearts")
        ]
        cards.sort()
        pair = PairValidator(cards=cards)

        self.assertEqual(pair.valid_cards(), [nine_clubs, nine_diamonds])
コード例 #4
0
    def test_returns_a_winning_hand_with_pair_from_card_collection(self):
        seven_of_diamonds = Card(rank="7", suit="Diamonds")
        seven_of_spades = Card(rank="7", suit="Spades")

        cards = [
            Card(rank="2", suit="Spades"),
            Card(rank="5", suit="Spades"), seven_of_diamonds, seven_of_spades,
            Card(rank="8", suit="Diamonds"),
            Card(rank="10", suit="Clubs"),
            Card(rank="Queen", suit="Clubs")
        ]

        validator = PairValidator(cards=cards)
        self.assertEqual(validator.valid_cards(), [
            Card(rank="8", suit="Diamonds"),
            Card(rank="10", suit="Clubs"),
            Card(rank="Queen", suit="Clubs"), seven_of_diamonds,
            seven_of_spades
        ])