Bug fix, add tests for environment checker and passive environment checker wrapper (#2903)

This commit is contained in:
Mark Towers
2022-07-11 02:45:24 +01:00
committed by GitHub
parent 907b1b20dd
commit 015b31fa76
20 changed files with 1365 additions and 402 deletions

View File

@@ -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})