diff --git a/gymnasium/core.py b/gymnasium/core.py index 8225e4905..9dfe63876 100644 --- a/gymnasium/core.py +++ b/gymnasium/core.py @@ -307,7 +307,9 @@ def __init__(self, env: Env[ObsType, ActType]): env: The environment to wrap """ self.env = env - assert isinstance(env, Env) + assert isinstance( + env, Env + ), f"Expected env to be a `gymnasium.Env` but got {type(env)}" self._action_space: spaces.Space[WrapperActType] | None = None self._observation_space: spaces.Space[WrapperObsType] | None = None diff --git a/gymnasium/vector/vector_env.py b/gymnasium/vector/vector_env.py index 0956184f7..7a59a11a2 100644 --- a/gymnasium/vector/vector_env.py +++ b/gymnasium/vector/vector_env.py @@ -355,7 +355,9 @@ def __init__(self, env: VectorEnv): env: The environment to wrap """ self.env = env - assert isinstance(env, VectorEnv) + assert isinstance( + env, VectorEnv + ), f"Expected env to be a `gymnasium.vector.VectorEnv` but got {type(env)}" self._observation_space: gym.Space | None = None self._action_space: gym.Space | None = None