code: def test_register_versioned_unversioned():
      # Register versioned then unversioned
      versioned_env = "Test/MyEnv-v0"
      gym.register(versioned_env, "no-entry-point")
      assert gym.envs.spec(versioned_env).id == versioned_env
  
      unversioned_env = "Test/MyEnv"
      with pytest.raises(
          gym.error.RegistrationError,
          match=re.escape(
              "Can't register the unversioned environment `Test/MyEnv` when the versioned environment `Test/MyEnv-v0` of the same name already exists"
          ),
      ):
          gym.register(unversioned_env, "no-entry-point")
  
      # Clean everything
      del gym.envs.registry[versioned_env]
  
      # Register unversioned then versioned
      gym.register(unversioned_env, "no-entry-point")
      assert gym.envs.spec(unversioned_env).id == unversioned_env
      with pytest.raises(
          gym.error.RegistrationError,
          match=re.escape(
              "Can't register the versioned environment `Test/MyEnv-v0` when the unversioned environment `Test/MyEnv` of the same name already exists."
          ),
      ):
          gym.register(versioned_env, "no-entry-point")
  
      # Clean everything
      del gym.envs.registry[unversioned_env]
  
file_path: gym/tests/envs/test_register.py
imports: import re
  from typing import Optional
  import pytest
  import gym
label_desc: Use image node_id 6 for calling a global function with example usage: test_register_versioned_unversioned() without return types