mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-29 17:45:07 +00:00
* removed return_info, made info dict mandatory in reset * tenatively removed deprecated seed api for environments * added more info type checks to wrapper tests * formatting/style compliance * addressed some comments * polish to address review * fixed tests after merge, and added a test of the return_info deprecation assertion if found in reset signature * some organization of env_checker tests, reverted a probably merge error * added deprecation check for seed function in env * updated docstring * removed debug prints, tweaked test_check_seed_deprecation * changed return_info deprecation check from assertion to warning * fixes to vector envs, now should be correctly structured * added some explanation and typehints for mockup depcreated return info reset function * re-removed seed function from vector envs * added explanation to _reset_return_info_type and changed the return statement
27 lines
920 B
Python
27 lines
920 B
Python
import pytest
|
|
|
|
import gym
|
|
from gym import spaces
|
|
from gym.wrappers import GrayScaleObservation
|
|
|
|
|
|
@pytest.mark.parametrize("env_id", ["CarRacing-v2"])
|
|
@pytest.mark.parametrize("keep_dim", [True, False])
|
|
def test_gray_scale_observation(env_id, keep_dim):
|
|
rgb_env = gym.make(env_id, disable_env_checker=True)
|
|
|
|
assert isinstance(rgb_env.observation_space, spaces.Box)
|
|
assert len(rgb_env.observation_space.shape) == 3
|
|
assert rgb_env.observation_space.shape[-1] == 3
|
|
|
|
wrapped_env = GrayScaleObservation(rgb_env, keep_dim=keep_dim)
|
|
assert isinstance(wrapped_env.observation_space, spaces.Box)
|
|
if keep_dim:
|
|
assert len(wrapped_env.observation_space.shape) == 3
|
|
assert wrapped_env.observation_space.shape[-1] == 1
|
|
else:
|
|
assert len(wrapped_env.observation_space.shape) == 2
|
|
|
|
wrapped_obs, info = wrapped_env.reset()
|
|
assert wrapped_obs in wrapped_env.observation_space
|