code: def test_obtain_exact_episodes():
      max_episode_length = 15
      n_workers = 8
      env = PointEnv()
      per_worker_actions = [
          env.action_space.sample() for _ in range(n_workers)
      ]
      policies = [
          FixedPolicy(env.spec, [action] * max_episode_length)
          for action in per_worker_actions
      ]
      workers = WorkerFactory(
          seed=100,
          max_episode_length=max_episode_length,
          n_workers=n_workers,
      )
      sampler = LocalSampler.from_worker_factory(
          workers, policies, envs=env
      )
      n_eps_per_worker = 3
      episodes = sampler.obtain_exact_episodes(
          n_eps_per_worker, agent_update=policies
      )
      # At least one action per episode.
      assert sum(episodes.lengths) >= n_workers * n_eps_per_worker
      # All of the episodes.
      assert len(episodes.lengths) == n_workers * n_eps_per_worker
      worker = -1
      for count, eps in enumerate(episodes.split()):
          if count % n_eps_per_worker == 0:
              worker += 1
          assert (eps.actions == per_worker_actions[worker]).all()
  
file_path: garage/tests/garage/sampler/test_local_sampler.py
imports: import numpy
  import pytest
  from garage.envs import PointEnv
  from garage.experiment.task_sampler import SetTaskSampler
  from garage.np.policies import FixedPolicy
  from garage.sampler import LocalSampler, WorkerFactory
label_desc: Use image node_id 3 for calling a global function with example usage: test_obtain_exact_episodes() without return types