code: def test_env_pool_sampler():
      # Import, construct environments here to avoid using up too much
      # resources if this test isn't run.
      # pylint: disable=import-outside-toplevel
      envs = [HalfCheetahVelEnv() for _ in range(5)]
      tasks = task_sampler.EnvPoolSampler(envs)
      assert tasks.n_tasks == 5
      updates = tasks.sample(5)
      for env in envs:
          assert any(env is update() for update in updates)
      with pytest.raises(ValueError):
          tasks.sample(5, with_replacement=True)
      with pytest.raises(ValueError):
          tasks.sample(6)
      tasks.grow_pool(10)
      tasks.sample(10)
  
file_path: garage/tests/garage/experiment/test_task_sampler.py
imports: import functools
  import unittest.mock
  import numpy
  import pytest
  from garage.experiment import task_sampler
  from garage.envs.mujoco.half_cheetah_vel_env import HalfCheetahVelEnv
label_desc: Use image node_id 1 for calling a global function with example usage: test_env_pool_sampler() without return types