mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-23 15:04:20 +00:00
Support only new step API (while retaining compatibility functions) (#3019)
This commit is contained in:
@@ -68,7 +68,7 @@ def test_step_async_vector_env(shared_memory, use_single_action_space):
|
||||
actions = [env.single_action_space.sample() for _ in range(8)]
|
||||
else:
|
||||
actions = env.action_space.sample()
|
||||
observations, rewards, dones, _ = env.step(actions)
|
||||
observations, rewards, terminateds, truncateds, _ = env.step(actions)
|
||||
|
||||
env.close()
|
||||
|
||||
@@ -83,10 +83,15 @@ def test_step_async_vector_env(shared_memory, use_single_action_space):
|
||||
assert rewards.ndim == 1
|
||||
assert rewards.size == 8
|
||||
|
||||
assert isinstance(dones, np.ndarray)
|
||||
assert dones.dtype == np.bool_
|
||||
assert dones.ndim == 1
|
||||
assert dones.size == 8
|
||||
assert isinstance(terminateds, np.ndarray)
|
||||
assert terminateds.dtype == np.bool_
|
||||
assert terminateds.ndim == 1
|
||||
assert terminateds.size == 8
|
||||
|
||||
assert isinstance(truncateds, np.ndarray)
|
||||
assert truncateds.dtype == np.bool_
|
||||
assert truncateds.ndim == 1
|
||||
assert truncateds.size == 8
|
||||
|
||||
|
||||
@pytest.mark.parametrize("shared_memory", [True, False])
|
||||
@@ -169,7 +174,7 @@ def test_step_timeout_async_vector_env(shared_memory):
|
||||
with pytest.raises(TimeoutError):
|
||||
env.reset()
|
||||
env.step_async(np.array([0.1, 0.1, 0.3, 0.1]))
|
||||
observations, rewards, dones, _ = env.step_wait(timeout=0.1)
|
||||
observations, rewards, terminateds, truncateds, _ = env.step_wait(timeout=0.1)
|
||||
env.close(terminate=True)
|
||||
|
||||
|
||||
@@ -262,7 +267,7 @@ def test_custom_space_async_vector_env():
|
||||
assert isinstance(env.action_space, Tuple)
|
||||
|
||||
actions = ("action-2", "action-3", "action-5", "action-7")
|
||||
step_observations, rewards, dones, _ = env.step(actions)
|
||||
step_observations, rewards, terminateds, truncateds, _ = env.step(actions)
|
||||
|
||||
env.close()
|
||||
|
||||
|
Reference in New Issue
Block a user