def test_example(s, p): """ Build a farm and 2 pastures. Confirm raw wool is produced at the pastures and used by the farm to produce wool. """ settlement, island = settle(s) farm = Build(BUILDINGS.FARM_CLASS, 30, 30, island, settlement=settlement)(p) assert farm # Pause the production, we want to start it explicitly later. production = farm._get_production(7) production.pause() # Farm has no raw wool or wool. assert farm.inventory[RES.LAMB_WOOL_ID] == 0 assert farm.inventory[RES.WOOL_ID] == 0 # Build pastures, let the game run for 31 seconds. Pastures currently need # 30s to produce wool. p1 = Build(BUILDINGS.PASTURE_CLASS, 27, 30, island, settlement=settlement)(p) p2 = Build(BUILDINGS.PASTURE_CLASS, 33, 30, island, settlement=settlement)(p) assert p1 and p2 s.run(seconds=31) assert p1.inventory[RES.LAMB_WOOL_ID] assert p2.inventory[RES.LAMB_WOOL_ID] # Give farm collectors a chance to get the wool from the pastures. s.run(seconds=5) assert farm.inventory[RES.LAMB_WOOL_ID] # Resume the production, let the game run for a second. The farm should have # produced wool now. production.pause(pause=False) s.run(seconds=1) assert farm.inventory[RES.WOOL_ID]