def test_create_bacterium(self): """ Test to see if bacterium is created """ new_bacterium = create_bacterium(BACTERIA, 0) self.assertTrue(new_bacterium["prev_toxicity"] is None) self.assertTrue(new_bacterium["prev_nutricity"] is None) self.assertTrue(new_bacterium["angle"] is None)
def test_calc_nutrient(self): """ Test if we get proper nutrient level """ nutrients_group = Composite("nutrients") bacterium = create_bacterium(BACTERIA, 0) for i in range(TEST_NUTRI_NUM): nutrients_group += create_nutrient("nutrients", i) nutrient_strength = calc_nutrient(nutrients_group, bacterium) self.assertTrue(nutrient_strength > 0)
def test_calc_toxin(self): """ Test if we get proper toxin level """ toxins_group = Composite(TOXINS) bacterium = create_bacterium(BACTERIA, 0) for i in range(TEST_TOX_NUM): toxins_group += create_toxin(TOXINS, i) toxin_strength = calc_toxin(toxins_group, bacterium) self.assertTrue(toxin_strength < 0)
def test_bacterium_action(self): """ Test if the previous nutricity and toxicity of the bacterium change when the function is called """ bacterium = create_bacterium("Bacteria", 0) bacterium["prev_toxicity"] = 0 bacterium["prev_nutricity"] = 0 bacterium_action(bacterium) self.assertTrue(bacterium["prev_nutricity"] > 0) self.assertTrue(bacterium["prev_toxicity"] < 0)
def setUp(self): self.toxin = create_toxin(TOXINS, TEST_TOX_NUM) self.nutrient = create_nutrient(NUTRIENTS, TEST_NUTRI_NUM) self.bacterium = create_bacterium(BACTERIA, TEST_BAC_NUM)
def setUp(self): set_up() self.toxin = create_toxin("Toxins", TEST_TOX_NUM) self.nutrient = create_nutrient("Nutrients", TEST_NUTRI_NUM) self.bacterium = create_bacterium("Bacteria", TEST_BAC_NUM)