Skip to content

Commit

Permalink
Fix bug in API test: test_action_flexibility() (#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottower authored May 19, 2023
1 parent bb9625f commit 9b7ab76
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit 9b7ab76

Please sign in to comment.