class DeckTests(unittest.TestCase): def setUp(self): self.cardlist = [Card('One', 1), Card('Two', 2)] self.deck = Deck(self.cardlist) def testDraw(self): """Deck draw""" card = self.deck.draw() self.assertTrue(card in self.cardlist) self.assertEqual(1, len(self.deck.drawn)) self.assertEqual(1, len(self.deck.undrawn)) def testEmptyDraw(self): """Deck empty draw""" self.deck.draw() self.deck.draw() self.assertEqual(None, self.deck.draw()) def testShuffle(self): """Deck shuffle""" self.deck.draw() self.deck.shuffle() self.assertEqual(2, len(self.deck.undrawn)) self.assertEqual(0, len(self.deck.drawn))
def setUp(self): self.cardlist = [Card('One', 1), Card('Two', 2)] self.deck = Deck(self.cardlist)