def test_create_cards(self): """test the create_cards function""" ranks = create_ranks(['ship', 'shape', 'shop']) suits = create_suits(['x', 'y', 'z']) cards = create_cards(ranks, suits) for card in cards: self.assertEqual(card.__class__, Card) self.assertEqual(card, card) self.assertEqual(card, Card(Rank(card.rank.index, card.rank.label), Suit(card.suit.label))) self.assertEqual(len(ranks)*len(suits), len(cards)) self.assertNotEqual(cards[0], cards[2])
def test_create_suits(self): """test the create_suits function""" labels = ['frog', 'duck', 'deer'] suits = create_suits(labels) found_deer = False for suit in suits: self.assertEqual(suit.__class__, Suit) self.assertEqual(suit, suit) self.assertEqual(suit, Suit(suit.label)) self.assertEqual(suit.label, str(suit)) if suit.label == 'deer': found_deer = True self.assert_(found_deer) self.assertNotEqual(suits[0], suits[2])