def test_hand_add_card_new(self): """testing add card works""" prev_len = self.hand.num_cards() assert not self.hand.contains(card.Card('4', 'h')) self.hand.add_cards([card.Card('4', 'h')]) assert self.hand.contains(card.Card('4', 'h')) assert self.hand.num_cards() == prev_len + 1
def test_hand_get_low_triple_double_invalid(self): """tests get low on invalid triple double""" c = card.Card('2', 'h') each_count = 3 extra = 2 low_card_play = self.hand_adj_trip.get_low(c, each_count, extra=extra) assert not low_card_play
def test_hand_get_low_wild_simple_valid(self): """tests get valid low wild""" c = card.Card('5', 'h') play = self.hand.get_low_wild(c) _check_quadruples(play.cards) assert play.get_base_card() > c _print_card_list(play, extra_msg="greater than {}".format(str(c)))
def test_hand_remove_card_invalid(self): """testing remove cards works""" prev_len = self.hand.num_cards() c = card.Card('3', 'h') assert not self.hand.contains(c) self.hand.remove_cards([c]) assert self.hand.num_cards() == prev_len
def test_hand_add_card_dup(self): """testing add duiplicate card doesnt work""" prev_len = self.hand.num_cards() c = card.Card('7', 'h') assert self.hand.contains(c) self.hand.add_cards([c]) assert self.hand.num_cards() == prev_len
def test_hand_get_low_double_valid(self): """tests get low on a valid double""" c = card.Card('3', 'h') each_count = 2 play = self.hand.get_low(c, each_count) assert play.get_base_card() > c _check_double(play.cards) _print_card_list(play, extra_msg="greater than {}".format(str(c)))
def test_hand_get_low_adj_trip_double_valid(self): """tests get valid adj trip with 4 extras""" c = card.Card('4', 'h') play = self.hand_adj_trip.get_low_adj_triple(c, 4) assert play.num_cards() == 10 assert play.get_base_card() > c _check_adj_triple(play.cards, 4) _print_card_list(play, extra_msg="greater than {}".format(str(c)))
def test_hand_get_low_triple_double_valid(self): """tests get low on a valid triple double""" c = card.Card('3', 'h') each_count = 3 extra = 2 play = self.hand_adj_trip.get_low(c, each_count, extra=extra) assert play.get_base_card() > c assert play.num_cards() == 5 _check_triple(play.cards) _print_card_list(play, extra_msg="greater than {}".format(str(c)))
def test_hand_triple_straights_valid(self): """tests get valid low triple straight""" c = card.Card('4', 'h') each_count = 3 length = 2 play = self.hand_adj_trip.get_low_straight(c, each_count, length) _check_straight(play.cards, 3) assert play.num_cards() == length * each_count assert play.get_base_card() > c _print_card_list(play, extra_msg="greater than {}".format(str(c)))
def test_card_display_6(self): """Testing card displays""" assert str(card.Card(card.VALUES[3], card.SUITS[2])) == '♠6'
def test_card_is_gt(self): """Testing greater than""" assert card.Card('Z', 1) > card.Card('9', 'h')
def test_card_is_ge(self): """Testing greater than or equal""" assert card.Card('0', 'c') >= card.Card('9', 'h')
def test_card_is_eq(self): """Testing equals""" assert card.Card('6', 'c') == card.Card('6', 'c')
def test_card_is_le(self): """Testing less than or equal""" assert card.Card('9', 'c') <= card.Card('9', 'h')
def test_card_display_big_joker(self): """Testing if card recognizes big joker""" assert str(card.Card("Z", 1)) == 'JOKER'
def test_hand_get_low_double_invalid(self): """tests get low on invalid double""" c = card.Card('2', 'h') each_count = 2 low_card_play = self.hand.get_low(c, each_count) assert not low_card_play
def test_hand_single_straights_invalid(self): """tests get invalid low single straight""" c = card.Card('5', 'h') each_count = 1 length = 5 assert not self.hand.get_low_straight(c, each_count, length)
def test_hand_get_low_wild_simple_invalid(self): """tests get invalid low wild""" c = card.Card('7', 'h') assert not self.hand.get_low_wild(c)
def test_hand_double_straights_invalid(self): """tests get invalid low double straight""" c = card.Card('0', 'h') each_count = 2 length = 3 assert not self.hand.get_low_straight(c, each_count, length)
def test_hand_get_cards(self): """testing that cards are retrieved properly""" assert self.hand.contains(card.Card('7', 'h'))
def test_card_display_Q(self): """Testing card displays""" assert str(card.Card(card.VALUES[9], card.SUITS[1])) == '♦Q'
def test_card_display_invalid_joker(self): """Testing if card recognizes invalid jokers""" assert str(card.Card("Z", card.SUITS[3])) == 'INVALID'
def test_card_is_royal_simple2(self): """Testing is royal""" assert not card.Card('0', card.SUITS[2]).is_royal()
def test_card_display_small_joker(self): """Testing if card recognizes big joker""" assert str(card.Card("Z", 0)) == 'joker'
def test_card_is_lt(self): """Testing less than""" assert card.Card('8', 'c') < card.Card('9', 'h')