Пример #1
0
    def test_eq(self):
        """"""
        # This wouldn't be needed if hammett executed the setup routine.
        self.full_stack = stack.PinochleStack(cards=tools.build_cards())

        other_stack = stack.PinochleStack(cards=tools.build_cards())

        result = self.full_stack == other_stack

        self.assertTrue(result)
Пример #2
0
    def test_str(self):
        """"""
        # This wouldn't be needed if hammett executed the setup routine.
        self.full_stack = stack.PinochleStack(cards=tools.build_cards())

        result = str(self.full_stack[0])

        self.assertEqual(result, "9 of Diamonds")
Пример #3
0
    def test_len(self):
        """"""
        # This wouldn't be needed if hammett executed the setup routine.
        self.full_stack = stack.PinochleStack(cards=tools.build_cards())

        result = len(self.full_stack)

        self.assertIs(result, 24)
Пример #4
0
    def test_empty(self):
        """"""
        # This wouldn't be needed if hammett executed the setup routine.
        self.full_stack = stack.PinochleStack(cards=tools.build_cards())

        cards = self.full_stack.empty(return_cards=True)

        self.assertEqual(len(cards), 24)
        self.assertEqual(len(self.full_stack), 0)
Пример #5
0
    def test_get_partial_suit(self):
        """"""
        # This wouldn't be needed if hammett executed the setup routine.
        self.full_stack = stack.PinochleStack(cards=tools.build_cards())

        found = self.full_stack.get("Spades")

        self.assertEqual(len(found), 6)
        for test_card in found:
            self.assertEqual(test_card.suit, "Spades")
Пример #6
0
    def test_get_full(self):
        """"""
        # This wouldn't be needed if hammett executed the setup routine.
        self.full_stack = stack.PinochleStack(cards=tools.build_cards())

        found = self.full_stack.get("Ace of Spades")
        test_card = found[0]

        self.assertEqual(len(found), 1)
        self.assertEqual(test_card.name, "Ace of Spades")
Пример #7
0
 def setUp(self):
     """"""
     self.ace_spades = card.PinochleCard("Ace", "Spades")
     self.nine_diamonds = card.PinochleCard("9", "Diamonds")
     self.queen_hearts = card.PinochleCard("Queen", "Hearts")
     self.king_clubs = card.PinochleCard("King", "Clubs")
     self.cards = [
         self.ace_spades,
         self.nine_diamonds,
         self.queen_hearts,
         self.king_clubs,
     ]
     self.names = [
         "Ace of Spades",
         "9 of Diamonds",
         "Queen of Hearts",
         "King of Clubs",
     ]
     self.stack = stack.PinochleStack()
     self.full_stack = stack.PinochleStack(cards=tools.build_cards())
     self.small_stack = stack.PinochleStack(cards=self.cards)
Пример #8
0
    def test_build_cards(self):
        """"""
        cards = tools.build_cards()

        self.assertEqual(list(self.deck.cards), cards)