Ejemplo n.º 1
0
 def test_isactive(self):
     """
     Test to see if isactive returns  correct values for alive and dead
     agents.
     """
     self.assertEqual(True, isactive(self.sheep))
     self.sheep.die()
     self.assertEqual(False, isactive(self.sheep))
Ejemplo n.º 2
0
 def test_isactive(self):
     """
     Test to see if isactive returns  correct values for alive and dead
     agents.
     """
     self.assertEqual(True, isactive(self.sheep))
     self.sheep.die()
     self.assertEqual(False, isactive(self.sheep))
Ejemplo n.º 3
0
 def test_eat(self):
     """
     When wolf eats sheep, wolf gains life, sheep dies.
     """
     eat(self.wolf, self.sheep)
     self.assertEqual(self.wolf.duration, WOLF_LIFESPAN + SHEEP_LIFESPAN)
     # the sheep should be dead!
     self.assertFalse(isactive(self.sheep))
Ejemplo n.º 4
0
 def test_eat(self):
     """
     When wolf eats sheep, wolf gains life, sheep dies.
     """
     eat(self.wolf, self.sheep)
     self.assertEqual(self.wolf.duration, WOLF_LIFESPAN
                      + SHEEP_LIFESPAN)
     # the sheep should be dead!
     self.assertFalse(isactive(self.sheep))