docstr: Tests a gymnasium Env that uses the new API, but has old spaces.
docstr_tok: ["Tests","a","gymnasium","Env","that","uses","the","new","API",",","but","has","old","spaces","."]
code: def test_gymnasium_new_api_but_old_spaces(self):
      """Tests a gymnasium Env that uses the new API, but has old spaces."""
  
      def test_():
          (
              PPOConfig()
              .environment(
                  GymnasiumNewAPIButOldSpaces,
                  auto_wrap_old_gym_envs=True,
              )
              # Forces the error to be raised on the local worker so that it is not
              # swallowed by a RayActorError and speeds the test up.
              .rollouts(num_rollout_workers=0)
              .build()
          )
  
      self.assertRaisesRegex(
          ValueError,
          "Observation space must be a gymnasium.Space!",
          lambda: test_(),
      )
  
imports: import unittest
  import ray
  from ray.rllib.algorithms.ppo import PPOConfig
  from ray.rllib.env.multi_agent_env import MultiAgentEnv
  from ray.rllib.env.wrappers.multi_agent_env_compatibility import MultiAgentEnvCompatibility
  from ray.rllib.utils.gym import try_import_gymnasium_and_gym
  from ray.tune.registry import register_env
label_desc: Use image node_id 5 for calling the TestGymEnvAPIs obj's underlying member method code with example usage: obj.test_gymnasium_new_api_but_old_spaces() without return types