Пример #1
0
    def test_eaten_removes_herb(self):
        """Test to show that eaten removes dead herb from location
        """
        i = Island()
        loc = (2, 7)
        a = Herbivore(i, loc)
        ini_pop = a.get_num_same_species(loc)
        a.eaten()
        new_pop = a.get_num_same_species(loc)

        assert ini_pop != new_pop
Пример #2
0
    def test_birth_does_not_add_new_baby_if_weight_too_low(self, mocker):
        """Test to show that if birth weight is too low, a new baby will not
        be born"""
        a_sim_1 = Herbivore(self.i, self.loc, weight=1)
        mocker.return_value = True
        a_sim_2 = Herbivore(self.i, self.loc, weight=1)
        old_pop = a_sim_1.get_num_same_species(self.loc)
        a_sim_1.birth()
        new_pop = a_sim_1.get_num_same_species(self.loc)

        assert old_pop == new_pop
Пример #3
0
    def test_get_num_same_species_herb(self):
        """Test to show that get_num_same_species
        return is number of same species(herb)
        """
        i = Island()
        h_1 = Herbivore(i, self.loc)
        h_2 = Herbivore(i, self.loc)

        assert h_1.get_num_same_species(self.loc) == 2