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)
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")
def test_repr(self): """""" # This wouldn't be needed if hammett executed the setup routine. self.stack = stack.PinochleStack() result = repr(self.stack) self.assertEqual(result, "PinochleStack(cards=deque([]))")
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)
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)
def test_get_list_mixed(self): """""" # This wouldn't be needed if hammett executed the setup routine. self.small_stack = stack.PinochleStack(cards=self.cards) mixed_list = ["AS", "9 of Diamonds", "Hearts", "King"] found = self.small_stack.get_list(mixed_list) self.get_list_helper(found)
def test_get_list_partial_suit(self): """""" # This wouldn't be needed if hammett executed the setup routine. self.small_stack = stack.PinochleStack(cards=self.cards) partial_list = ["Spades", "Diamonds", "Hearts", "Clubs"] found = self.small_stack.get_list(partial_list) self.get_list_helper(found)
def test_get_list_partial_value(self): """""" # This wouldn't be needed if hammett executed the setup routine. self.small_stack = stack.PinochleStack(cards=self.cards) partial_list = ["Ace", "9", "Queen", "King"] found = self.small_stack.get_list(partial_list) self.get_list_helper(found)
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")
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")
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)
def test_save_cards(self): """""" # This wouldn't be needed if hammett executed the setup routine. self.small_stack = stack.PinochleStack(cards=self.cards) names = [ "Ace Spades\n", "9 Diamonds\n", "Queen Hearts\n", "King Clubs" ] self.small_stack.save_cards("tests/cards-save.txt") with open("tests/cards-save.txt", "r") as cards_save: lines = cards_save.readlines() for i, name in enumerate(names): self.assertEqual(lines[i], name)
def test_get_list_full(self): """""" full_list = [ "Ace of Spades", "9 of Diamonds", "Queen of Hearts", "King of Clubs", ] # This wouldn't be needed if hammett executed the setup routine. self.small_stack = stack.PinochleStack(cards=self.cards) found = self.small_stack.get_list(full_list) self.get_list_helper(found)