Exemplo n.º 1
0
class TestWar(unittest.TestCase):
    """ Submodule for unittests, derives from unittest.TestCase """
    def setUp(self):
        """ Create object for all tests """
        self.war = War()

    def tearDown(self):
        """ Remove dependencies after test """
        self.war = None

    def test_generate_players(self):
        """Test if function generate players work"""
        self.assertEqual(len(self.war.players), 2)

    def test_draw_cards(self):
        """Test if function draw cards works"""
        self.war.draw_cards()
        self.assertEqual(len(self.war.players[0].cards), 25)

    def test_append_cards(self):
        """Test function append cards"""
        self.war.draw_cards()
        self.war.append_cards(0)
        self.assertEqual(len(self.war.players[0].cards), 27)