code: def test_sample_and_step():
      # Import, construct environments here to avoid using up too much
      # resources if this test isn't run.
      # pylint: disable=import-outside-toplevel
      import metaworld
  
      ml1 = metaworld.ML1("push-v1")
      env = MetaWorldSetTaskEnv(ml1, "train")
      assert env.num_tasks == 50
      task = env.sample_tasks(1)[0]
      env.set_task(task)
      env.step(env.action_space.sample())
      env.close()
      env2 = MetaWorldSetTaskEnv()
      env2.set_task(task)
      env2.step(env.action_space.sample())
      env2.close()
      tasks = env.sample_tasks(100)
      assert len(tasks) == 100
  
file_path: garage/tests/garage/envs/test_metaworld_set_task_env.py
imports: import pytest
  from garage.envs import MetaWorldSetTaskEnv
  from garage.experiment.task_sampler import MetaWorldTaskSampler
  from garage.sampler import LocalSampler, SetTaskUpdate, WorkerFactory
label_desc: Use image node_id 1 for calling a global function with example usage: test_sample_and_step() without return types