From 9b7ab7678edc850b2301211e15b30e31e38b4998 Mon Sep 17 00:00:00 2001 From: Elliot Tower Date: Fri, 19 May 2023 01:57:45 -0400 Subject: [PATCH] Fix bug in API test: test_action_flexibility() (#986) --- pettingzoo/test/api_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pettingzoo/test/api_test.py b/pettingzoo/test/api_test.py index 168a9da71..c2fc47eb0 100644 --- a/pettingzoo/test/api_test.py +++ b/pettingzoo/test/api_test.py @@ -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): @@ -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))