def test_default_time_limit(): # We need an env without a default limit register( id='test.NoLimitDummyVNCEnv-v0', entry_point='universe.envs:DummyVNCEnv', tags={ 'vnc': True, }, ) env = gym.make('test.NoLimitDummyVNCEnv-v0') env.configure(_n=1) env = wrappers.TimeLimit(env) env.reset() assert env._max_episode_seconds == wrappers.time_limit.DEFAULT_MAX_EPISODE_SECONDS assert env._max_episode_steps == None
def test_steps_limit_restart(): env = gym.make('test.StepsLimitDummyVNCEnv-v0') env.configure(_n=1) env = wrappers.TimeLimit(env) env.reset() assert env._max_episode_seconds == None assert env._max_episode_steps == 2 # Episode has started _, _, done, info = env.step([[]]) assert done == [False] # Limit reached, now we get a done signal and the env resets itself _, _, done, info = env.step([[]]) assert done == [True] assert env._elapsed_steps == 0