def is_valid(self):
        straight_flush_validator = StraightFlushValidator(cards=self.cards)
        if straight_flush_validator.is_valid():
            straight_flush_cards = straight_flush_validator.valid_cards()
            return straight_flush_cards[-1].rank == "Ace"

        return False
 def test_validates_that_cards_have_a_straight_flush(self):
     validator = StraightFlushValidator(cards = self.cards)
 
     self.assertEqual(
         validator.is_valid(),
         True
     )
    def is_valid(self):
        straight_flush = StraightFlushValidator(cards=self.cards)
        if straight_flush.is_valid():
            cards = straight_flush.valid_cards()
            if cards[-1].rank == "Ace":
                return True

        return False
    def is_valid(self):
        straight_flash_validator = StraightFlushValidator(cards=self.cards)
        if straight_flash_validator.is_valid():
            straight_flash_cards = straight_flash_validator.valid_cards()
            is_royal = straight_flash_cards[-1].rank == 'Ace'
            return is_royal

        return False
    def test_dtermines_that_there_are_not_five_consecutive_cards_with_same_suit(
            self):
        cards = [
            Card(rank="3", suit="Clubs"),
            Card(rank="4", suit="Clubs"),
            Card(rank="5", suit="Clubs"),
            Card(rank="6", suit="Clubs"),
            Card(rank="7", suit="Clubs"),
            Card(rank="King", suit="Clubs"),
            Card(rank="Ace", suit="Diamonds")
        ]

        validator = StraightFlushValidator(cards=cards)

        self.assertEqual(validator.is_valid(), True)
    def test_determines_that_there_are_not_five_consecutive_cards_with_the_same_suit(
            self):
        cards = [
            Card(rank='7', suit='Diamonds'),
            Card(rank='8', suit='Diamonds'),
            Card(rank='9', suit='Diamonds'),
            Card(rank='10', suit='Diamonds'),
            Card(rank='Jack', suit='Hearts'),
            Card(rank='King', suit='Diamonds'),
            Card(rank='Ace', suit='Clubs'),
        ]

        validator = StraightFlushValidator(cards=cards)

        self.assertEqual(validator.is_valid(), False)
 def test_straigh_flush_is_not_valid(self):
     '''
     straight flush occurs when
     all rank are sequential and
     suite is same
     '''
     cards = [
         Card(rank="4", suite="hearts"),
         Card(rank="5", suite="hearts"),
         Card(rank="6", suite="hearts"),
         Card(rank="7", suite="hearts"),
         Card(rank="8", suite="hearts"),
         Card(rank="King", suite="hearts")
     ]
     validator = StraightFlushValidator(cards=cards)
     self.assertEqual(validator.is_valid(), True)