Esempio n. 1
0
 def test_shuffle(self):
     '''
     test method shuffle()
     '''
     shoe = Shoe(8)
     self.assertEqual("Ac", str(shoe.deal()), "no shuffle Ace clubs first")
     shoe.reset()
     expected_clubs = "Ac2c3c4c5c6c7c8c9cTcJcQcKc"
     cards = ""
     for _ in range(13):
         cards += str(shoe.deal())
     self.assertEqual(expected_clubs, cards, "pre-shuffle")
     shoe.shuffle()
     cards = ""
     for _ in range(13):
         cards += str(shoe.deal())
     self.assertNotEqual(expected_clubs, cards, "post-shuffle")
Esempio n. 2
0
 def test_cut_card_seen(self):
     '''!
     test method cut_card_seen()
     '''
     shoe = Shoe(8)
     self.assertTrue(shoe.cut_card_seen(), "new shoe, yes")
     shoe.set_cut_card(1)
     self.assertFalse(shoe.cut_card_seen(), "position 1 no deal, no")
     card1 = shoe.deal()
     self.assertTrue(shoe.cut_card_seen(), "after 1 dealt, then yes")
Esempio n. 3
0
    def test_deal(self):
        '''!
        test method deal()
        '''
        shoe = Shoe(8)
        card1 = shoe.deal()
        # no shuffle so Ac should start us out
        self.assertEqual("Ac", str(card1), "no shuffle Ac first card")

        # create a short custom shoe to test running out of cards
        shoe2 = Shoe([
            Card(43),
            Card(44),
            Card(45),
        ])
        # only 3 cards in this shoe2
        card1 = shoe2.deal()
        self.assertIsNotNone(card1, "first of shoe2")
        card1 = shoe2.deal()
        self.assertIsNotNone(card1, "second of shoe2")
        card1 = shoe2.deal()
        self.assertIsNotNone(card1, "third of shoe2")
        card1 = shoe2.deal()
        self.assertIsNone(card1, "fourth of shoe2 (empty)")