Пример #1
0
 def test_sheep_action(self):
     time_to_repro = self.sheep["time_to_repr"]
     sheep_action(self.sheep)
     if time_to_repro == 1:
         self.assertEqual(self.sheep["time_to_repr"], SHEEP_REPRO_PERIOD)
     else:
         self.assertEqual(self.sheep["time_to_repr"], time_to_repro - 1)
Пример #2
0
 def test_sheep_action(self):
     time_to_repro = self.sheep["time_to_repr"]
     sheep_action(self.sheep)
     if time_to_repro == 1:
             self.assertEqual(self.sheep["time_to_repr"], SHEEP_REPRO_PERIOD)
     else:
         self.assertEqual(self.sheep["time_to_repr"], time_to_repro - 1)
Пример #3
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)
Пример #4
0
    def test_sheep_action(self):
        """
        Sheep act by moving around the meadow and reproducing
        """

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

        # Get TIME_TO_REPRODUCE attribute
        time_to_repro = self.sheep.get_attr(TIME_TO_REPRODUCE)

        # Run again
        sheep_action(self.sheep)

        if time_to_repro == 1:
            self.assertEqual(self.sheep.get_attr(TIME_TO_REPRODUCE),
                             SHEEP_REPRO_PERIOD)
        else:
            self.assertEqual(self.sheep.get_attr(TIME_TO_REPRODUCE),
                             time_to_repro - 1)