Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in API test test_action_flexibility() #986

Merged
merged 1 commit into from
May 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pettingzoo/test/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ def play_test(env, observation_0, num_cycles):


def test_action_flexibility(env):
env.reset()
"""Tests that a given action is valid given a seeded environment reset"""
env.reset(seed=0)
agent = env.agent_selection
action_space = env.action_space(agent)
if isinstance(action_space, gymnasium.spaces.Discrete):
Expand All @@ -448,11 +449,11 @@ def test_action_flexibility(env):
else:
action = 0
env.step(action)
env.reset()
env.reset(seed=0)
env.step(np.int32(action))
elif isinstance(action_space, gymnasium.spaces.Box):
env.step(np.zeros_like(action_space.low))
env.reset()
env.reset(seed=0)
env.step(np.zeros_like(action_space.low))


Expand Down