code: def test_model_manipulation(model_class, goal_selection_strategy):
      env = BitFlippingEnv(
          N_BITS,
          continuous=model_class in [DDPG, SAC, TD3],
          max_steps=N_BITS,
      )
      env = DummyVecEnv([lambda: env])
  
      model = HER(
          "MlpPolicy",
          env,
          model_class,
          n_sampled_goal=3,
          goal_selection_strategy=goal_selection_strategy,
          verbose=0,
      )
      model.learn(150)
  
      model_predict(model, env, n_steps=20, additional_check=None)
  
      model.save("./test_her.zip")
      del model
  
      # NOTE: HER does not support VecEnvWrapper yet
      with pytest.raises(AssertionError):
          model = HER.load("./test_her.zip", env=VecNormalize(env))
  
      model = HER.load("./test_her.zip")
  
      # Check that the model raises an error when the env
      # is not wrapped (or no env passed to the model)
      with pytest.raises(ValueError):
          model.predict(env.reset())
  
      env_ = BitFlippingEnv(
          N_BITS,
          continuous=model_class in [DDPG, SAC, TD3],
          max_steps=N_BITS,
      )
      env_ = HERGoalEnvWrapper(env_)
  
      model_predict(model, env_, n_steps=20, additional_check=None)
  
      model.set_env(env)
      model.learn(150)
  
      model_predict(model, env_, n_steps=20, additional_check=None)
  
      assert model.n_sampled_goal == 3
  
      del model
  
      env = BitFlippingEnv(
          N_BITS,
          continuous=model_class in [DDPG, SAC, TD3],
          max_steps=N_BITS,
      )
      model = HER.load("./test_her", env=env)
      model.learn(150)
  
      model_predict(model, env_, n_steps=20, additional_check=None)
  
      assert model.n_sampled_goal == 3
  
      if os.path.isfile("./test_her.zip"):
          os.remove("./test_her.zip")
  
file_path: stable-baselines/tests/test_her.py
imports: import os
  import pytest
  from stable_baselines import HER, DQN, SAC, DDPG, TD3
  from stable_baselines.her import GoalSelectionStrategy, HERGoalEnvWrapper
  from stable_baselines.her.replay_buffer import KEY_TO_GOAL_STRATEGY
  from stable_baselines.common.bit_flipping_env import BitFlippingEnv
  from stable_baselines.common.vec_env import DummyVecEnv, VecNormalize
label_desc: Use image node_id 4 for calling a global function with example usage: test_model_manipulation(model_class, goal_selection_strategy) without return types