def test_will_not_eat_clockwork_fish(self): tank = TestTank() others = [simfish.ClockworkFish()] tank.add_items_with(*others) piranha_fish = simfish.PiranhaFish() self.assertEqual(others, tank.items_with(piranha_fish)) piranha_fish.turn(tank) self.assertEqual(others, tank.items_with(piranha_fish))
def test_will_not_eat_fish_food(self): tank = TestTank() others = [simfish.FishFood()] tank.add_items_with(*others) clockwork_fish = simfish.ClockworkFish() self.assertEqual(others, tank.items_with(clockwork_fish)) clockwork_fish.turn(tank) self.assertEqual(others, tank.items_with(clockwork_fish))
def test_will_eat_fish_food(self): tank = TestTank() others = [simfish.FishFood()] tank.add_items_with(*others) diver_fish = simfish.DiverFish() self.assertEqual(others, tank.items_with(diver_fish)) diver_fish.turn(tank) self.assertEqual(0, len(tank.items_with(diver_fish)))
def test_will_eat_diver_fish(self): tank = TestTank() others = [simfish.DiverFish()] tank.add_items_with(*others) piranha_fish = simfish.PiranhaFish() self.assertEqual(others, tank.items_with(piranha_fish)) piranha_fish.turn(tank) self.assertEqual(0, len(tank.items_with(piranha_fish)))
def test_will_eat_fish_food(self): tank = TestTank() others = [simfish.FishFood()] tank.add_items_with(*others) snail = simfish.Snail() self.assertEqual(others, tank.items_with(snail)) snail.turn(tank) self.assertEqual(0, len(tank.items_with(snail)))
def test_will_only_eat_one_item_per_turn(self): tank = TestTank() others = [simfish.FishFood(), simfish.SunFish(), simfish.DiverFish()] tank.add_items_with(*others) piranha_fish = simfish.PiranhaFish() for count in range(len(others), 0, -1): self.assertEqual(count, len(tank.items_with(piranha_fish))) piranha_fish.turn(tank) self.assertEqual(0, len(tank.items_with(piranha_fish)))
def test_will_only_eat_one_fish_food_per_turn(self): FOOD_COUNT = 10 tank = TestTank() others = [simfish.FishFood()] * FOOD_COUNT tank.add_items_with(*others) diver_fish = simfish.DiverFish() for count in range(FOOD_COUNT, 0, -1): self.assertEqual(count, len(tank.items_with(diver_fish))) diver_fish.turn(tank) self.assertEqual(0, len(tank.items_with(diver_fish)))
def test_will_only_eat_one_fish_food_per_turn(self): FOOD_COUNT = 10 tank = TestTank() others = [simfish.FishFood()] * FOOD_COUNT tank.add_items_with(*others) snail = simfish.Snail() for count in range(FOOD_COUNT, 0, -1): self.assertEqual(count, len(tank.items_with(snail))) snail.turn(tank) self.assertEqual(0, len(tank.items_with(snail)))
def test_will_not_eat_other_creatures(self): tank = TestTank() others = [ simfish.Snail(), simfish.SunFish(), simfish.DiverFish(), simfish.PiranhaFish(), simfish.ClockworkFish(), ] tank.add_items_with(*others) clockwork_fish = simfish.ClockworkFish() self.assertEqual(others, tank.items_with(clockwork_fish)) clockwork_fish.turn(tank) self.assertEqual(others, tank.items_with(clockwork_fish))