def test_add_cards_to_hand_no_pile(self): game = Egrt(0.5) card_1 = Card(Rank.FOUR, Suit.HEART) card_2 = Card(Rank.JACK, Suit.CLUB) game.prev_card = card_1 game.top_card = card_2 actual_hand = deque() game.add_cards_to_hand(actual_hand) self.assertEqual(list(actual_hand), [card_1, card_2]) self.assertEqual(len(game.pile), 0) self.assertIsNone(game.prev_card) self.assertIsNone(game.top_card) self.assertIsNone(game.chances_remaining)
def test_add_cards_to_hand_single_card_in_pile(self): game = Egrt(0.5) card_1 = Card(Rank.FOUR, Suit.HEART) card_2 = Card(Rank.SIX, Suit.SPADE) card_3 = Card(Rank.QUEEN, Suit.CLUB) game.pile.append(card_1) game.prev_card = card_2 game.top_card = card_3 actual_hand = deque() game.add_cards_to_hand(actual_hand) self.assertEqual(list(actual_hand), [card_1, card_2, card_3]) self.assertEqual(len(game.pile), 0) self.assertIsNone(game.prev_card) self.assertIsNone(game.top_card) self.assertIsNone(game.chances_remaining)
def test_add_cards_to_hand_multiple_cards_in_pile(self): game = Egrt(0.5) card_1 = Card(Rank.FOUR, Suit.HEART) card_2 = Card(Rank.SIX, Suit.SPADE) card_3 = Card(Rank.QUEEN, Suit.CLUB) card_4 = Card(Rank.TEN, Suit.DIAMOND) card_5 = Card(Rank.EIGHT, Suit.CLUB) card_6 = Card(Rank.TWO, Suit.CLUB) card_7 = Card(Rank.NINE, Suit.SPADE) game.pile.extend([card_1, card_2, card_3, card_4, card_5]) game.prev_card = card_6 game.top_card = card_7 actual_hand = deque() game.add_cards_to_hand(actual_hand) self.assertEqual( list(actual_hand), [card_1, card_2, card_3, card_4, card_5, card_6, card_7]) self.assertEqual(len(game.pile), 0) self.assertIsNone(game.prev_card) self.assertIsNone(game.top_card) self.assertIsNone(game.chances_remaining)
def test_is_slap_sandwich_slap(self): game = Egrt(0.5) game.prev_card = Card(Rank.SEVEN, Suit.CLUB) game.top_card = Card(Rank.SIX, Suit.DIAMOND) self.assertTrue(game.is_slap(Card(Rank.SIX, Suit.HEART)))
def test_is_slap_yes_is_slap(self): game = Egrt(0.5) game.prev_card = Card(Rank.ACE, Suit.CLUB) game.top_card = Card(Rank.QUEEN, Suit.DIAMOND) self.assertTrue(game.is_slap(Card(Rank.ACE, Suit.HEART)))
def test_is_slap_not_a_slap(self): game = Egrt(0.5) game.prev_card = Card(Rank.SEVEN, Suit.CLUB) game.top_card = Card(Rank.SIX, Suit.DIAMOND) self.assertFalse(game.is_slap(Card(Rank.FIVE, Suit.HEART)))
def test_is_slap_single_card_in_pile(self): game = Egrt(0.5) game.top_card = Card(Rank.JACK, Suit.DIAMOND) self.assertTrue(game.is_slap(Card(Rank.JACK, Suit.HEART)))
def test_set_chances_remaining_ace(self): game = Egrt(0.5) game.top_card = Card(Rank.JACK, Suit.SPADE) game.set_chances_remaining() self.assertEqual(game.chances_remaining, 1)
def test_set_chances_remaining_ace(self): game = Egrt(0.5) game.top_card = Card(Rank.QUEEN, Suit.DIAMOND) game.set_chances_remaining() self.assertEqual(game.chances_remaining, 2)
def test_set_chances_remaining_ace(self): game = Egrt(0.5) game.top_card = Card(Rank.KING, Suit.CLUB) game.set_chances_remaining() self.assertEqual(game.chances_remaining, 3)
def test_set_chances_remaining_ace(self): game = Egrt(0.5) game.top_card = Card(Rank.ACE, Suit.HEART) game.set_chances_remaining() self.assertEqual(game.chances_remaining, 4)
def test_set_chances_remaining_non_face_card(self): game = Egrt(0.5) game.top_card = Card(Rank.TEN, Suit.HEART) with self.assertRaises(ValueError): game.set_chances_remaining()
def test_add_cards_to_hand_no_prev_card(self): game = Egrt(0.5) game.top_card = Card(Rank.THREE, Suit.CLUB) with self.assertRaises(ValueError): game.add_cards_to_hand(deque())
def test_is_slap_king_queen_sandwich(self): game = Egrt(0.5) game.prev_card = Card(Rank.QUEEN, Suit.DIAMOND) game.top_card = Card(Rank.SIX, Suit.DIAMOND) self.assertFalse(game.is_slap(Card(Rank.KING, Suit.SPADE)))