mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-22 07:02:19 +00:00
* initial draft of optional info dict in reset function, implemented for cartpole, tests seem to be passing * merged core.py * updated return type annotation for reset function in core.py * optional metadata with return_info from reset added for all first party environments, with corresponding tests. Incomplete implementation for wrappers and vector wrappers * removed Optional type for return_info arguments * added tests for return_info to normalize wrapper and sync_vector_env * autoformatted using black * added optional reset metadata tests to several wrappers * added return_info capability to async_vector_env.py and test to verify functionality * added optional return_info test for record_video.py * removed tests for mujoco environments * autoformatted * improved test coverage for optional reset return_info * re-removed unit test envs accidentally reintroduced in merge * removed unnecessary import * changes based on code-review * small fix to core wrapper typing and autoformatted record_epsisode_stats * small change to pass flake8 style
22 lines
478 B
Python
22 lines
478 B
Python
import pytest
|
|
|
|
import numpy as np
|
|
|
|
import gym
|
|
from gym.wrappers import TimeLimit
|
|
|
|
|
|
def test_time_limit_reset_info():
|
|
env = gym.make("CartPole-v1")
|
|
env = TimeLimit(env)
|
|
ob_space = env.observation_space
|
|
obs = env.reset()
|
|
assert ob_space.contains(obs)
|
|
del obs
|
|
obs = env.reset(return_info=False)
|
|
assert ob_space.contains(obs)
|
|
del obs
|
|
obs, info = env.reset(return_info=True)
|
|
assert ob_space.contains(obs)
|
|
assert isinstance(info, dict)
|