示例#1
0
 def test_remove_migrated_carn(self):
     cell = BaseCell()
     assert len(cell.carnivores) == 0
     carnivore = Carnivore()
     cell.add_migrated_carn(carnivore)
     assert len(cell.carnivores) == 1
     cell.remove_migrated_carn(carnivore)
     assert len(cell.carnivores) == 0
示例#2
0
 def test_remove_migrated_herb(self):
     cell = BaseCell()
     assert len(cell.herbivores) == 0
     herbivore = Herbivore()
     cell.add_migrated_herb(herbivore)
     assert len(cell.herbivores) == 1
     cell.remove_migrated_herb(herbivore)
     assert len(cell.herbivores) == 0
示例#3
0
 def test_add_migrated_carn(self):
     cell = BaseCell()
     assert len(cell.carnivores) == 0
     cell.add_migrated_carn(Carnivore())
     assert len(cell.carnivores) == 1
示例#4
0
 def test_add_migrated_herb(self):
     cell = BaseCell()
     assert len(cell.herbivores) == 0
     cell.add_migrated_herb(Herbivore())
     assert len(cell.herbivores) == 1
示例#5
0
 def test_grow(self):
     cell = BaseCell()
     cell.grow()
     assert True
示例#6
0
 def test_init(self):
     cell = BaseCell()
     assert type(cell.herbivores) is list
     assert type(cell.carnivores) is list
     assert cell.fodder == 0
示例#7
0
 def test_num_animals(self):
     cell = BaseCell()
     carnivores = cell.num_carnivores
     herbivores = cell.num_herbivores
     assert cell.num_animals == carnivores + herbivores
示例#8
0
 def test_num_herbivore(self):
     cell = BaseCell()
     assert cell.num_herbivores == 0