code: def test_namespace():
      # Check if the namespace context manager works
      with gym.envs.registration.namespace("MyDefaultNamespace"):
          gym.register("MyDefaultEnvironment-v0", "no-entry-point")
      gym.register("MyDefaultEnvironment-v1", "no-entry-point")
      assert (
          "MyDefaultNamespace/MyDefaultEnvironment-v0"
          in gym.envs.registry
      )
      assert "MyDefaultEnvironment-v1" in gym.envs.registry
  
      del gym.envs.registry[
          "MyDefaultNamespace/MyDefaultEnvironment-v0"
      ]
      del gym.envs.registry["MyDefaultEnvironment-v1"]
  
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 8 for calling a global function with example usage: test_namespace() without return types