示例#1
0
 def test_reproduce(self):
     """
     Test to see if wolves reproduce at the right time.
     """
     self.wolf[TIME_TO_REPR] = 0
     reproduce(self.wolf, create_wolf, WOLF_GROUP)
     # self.assertTrue(reproduce(self.wolf, create_wolf, WOLF_GROUP))
     self.assertEqual(self.wolf[TIME_TO_REPR], WOLF_REPRO_PERIOD)
示例#2
0
 def test_reproduce_nonzerotimetorepr(self):
     """
     Negative test to check the reproduction of wolves.
     """
     self.wolf["time_to_repr"] = 1
     self.assertFalse(
         reproduce(self.wolf, create_wolf, wolves_created, ws.wolves))
示例#3
0
    def test_wolf_reproduce(self):
        """
        Check if wolf can reproduce
        """

        # Run once to initialize the attributes
        wolf_action(self.wolf)

        # Set TIME_TO_REPRODUCE to 0 for triggering reproduction
        self.wolf.set_attr(TIME_TO_REPRODUCE, 0)

        # Let wolf reproduce
        reproduce(self.wolf)

        self.assertEqual(self.wolf.get_attr(TIME_TO_REPRODUCE),
                         DEF_TIME_TO_REPRO)
示例#4
0
    def test_sheep_reproduce(self):
        """
        Check if sheep can reproduce
        """

        # Run once to initialize the attributes
        sheep_action(self.sheep)

        # Set TIME_TO_REPRODUCE to 0 for triggering reproduction
        self.sheep.set_attr(TIME_TO_REPRODUCE, 0)

        # Let sheep reproduce
        reproduce(self.sheep)

        self.assertEqual(self.sheep.get_attr(TIME_TO_REPRODUCE),
                         DEF_TIME_TO_REPRO)
示例#5
0
 def test_reproduce(self):
     """
     Test to see if wolves reproduce at the right time.
     """
     self.wolf["time_to_repr"] = 0
     self.assertTrue(
         reproduce(self.wolf, create_wolf, wolves_created, ws.wolves))
     self.assertEqual(self.wolf["time_to_repr"], WOLF_REPRO_PERIOD)
示例#6
0
 def test_reproduce_nonzerotimetorepr(self):
     """
     Negative test to check the reproduction of wolves.
     """
     self.wolf
     self.wolf["time_to_repr"] = 1
     self.assertFalse(reproduce(self.wolf, create_wolf,
                               wolves_created, ws.wolves))
示例#7
0
 def test_reproduce(self):
     """
     Test to see if wolves reproduce at the right time.
     """
     self.wolf
     self.wolf["time_to_repr"] = 0
     self.assertTrue(reproduce(self.wolf, create_wolf,
                               wolves_created, ws.wolves))
     self.assertEqual(self.wolf["time_to_repr"], WOLF_REPRO_PERIOD)
示例#8
0
 def test_reproduce_nonzerotimetorepr(self):
     """
     Negative test to check the reproduction of wolves.
     """
     self.wolf[TIME_TO_REPR] = 1
     self.assertFalse(reproduce(self.wolf, create_wolf, WOLF_GROUP))