mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-30 01:50:19 +00:00
Bug fix, add tests for environment checker and passive environment checker wrapper (#2903)
This commit is contained in:
@@ -168,17 +168,6 @@ def test_customizable_resets(env_name: str, low_high: Optional[list]):
|
||||
env.step(env.action_space.sample())
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"env_name", ["CartPole-v1", "MountainCar-v0", "MountainCarContinuous-v0"]
|
||||
)
|
||||
@pytest.mark.parametrize("low_high", [(-10.0, -9.0), (np.array(-10.0), np.array(-9.0))])
|
||||
def test_customizable_out_of_bounds_resets(env_name: str, low_high: Optional[list]):
|
||||
env = gym.make(env_name)
|
||||
low, high = low_high
|
||||
with pytest.raises(AssertionError):
|
||||
env.reset(options={"low": low, "high": high})
|
||||
|
||||
|
||||
# We test Pendulum separately, as the parameters are handled differently.
|
||||
@pytest.mark.parametrize(
|
||||
"low_high",
|
||||
@@ -221,4 +210,6 @@ def test_invalid_customizable_resets(env_name: str, low_high: list):
|
||||
env = gym.make(env_name)
|
||||
low, high = low_high
|
||||
with pytest.raises(ValueError):
|
||||
# match=re.escape(f"Lower bound ({low}) must be lower than higher bound ({high}).")
|
||||
# match=f"An option ({x}) could not be converted to a float."
|
||||
env.reset(options={"low": low, "high": high})
|
||||
|
Reference in New Issue
Block a user