code: def test_set_task_task_sampler_half_cheetah_vel_env():
      tasks = task_sampler.SetTaskSampler(HalfCheetahVelEnv)
      assert tasks.n_tasks is None
      updates = tasks.sample(10)
      envs = [update() for update in updates]
      action = envs[0].action_space.sample()
      rewards = [env.step(action)[1] for env in envs]
      assert np.var(rewards) > 0
      env = envs[0]
      env.close = unittest.mock.MagicMock(name="env.close")
      updates[-1](env)
      env.close.assert_not_called()
  
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 4 for calling a global function with example usage: test_set_task_task_sampler_half_cheetah_vel_env() without return types