def test_feeding_herb(self, mocker): mocker.patch('numpy.random.normal', return_value=3) h = Herb() return_fodder = h.feeding(300) assert h.weight == 3 + h.beta * h.F assert return_fodder == h.F h = Herb() return_fodder = h.feeding(5) assert h.weight == 3 + h.beta * 5 assert return_fodder == 5 with pytest.raises(ValueError): h.feeding(-5)
def test_feeding_herb(self, mocker): """Tests that the feeding of herbivores are done correctly. The mocker is used to give spesific values from random functions used in the module. """ mocker.patch("numpy.random.normal", return_value=3) h = Herb() return_fodder = h.feeding(300) assert h.weight == 3 + h.beta * h.F assert return_fodder == h.F h = Herb() return_fodder = h.feeding(5) assert h.weight == 3 + h.beta * 5 assert return_fodder == 5 with pytest.raises(ValueError): h.feeding(-5)