mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-23 15:04:20 +00:00
Update RescaleAction
and RescaleObservation
for np.inf
bounds (#1095)
This commit is contained in:
@@ -22,6 +22,16 @@ from gymnasium.utils.env_checker import (
|
||||
from tests.testing_env import GenericTestEnv
|
||||
|
||||
|
||||
CHECK_ENV_IGNORE_WARNINGS = [
|
||||
f"\x1b[33mWARN: {message}\x1b[0m"
|
||||
for message in [
|
||||
"A Box observation space minimum value is -infinity. This is probably too low.",
|
||||
"A Box observation space maximum value is infinity. This is probably too high.",
|
||||
"For Box action spaces, we recommend using a symmetric and normalized space (range=[-1, 1] or [0, 1]). See https://stable-baselines3.readthedocs.io/en/master/guide/rl_tips.html for more information.",
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"env",
|
||||
[
|
||||
@@ -51,6 +61,11 @@ def test_no_error_warnings(env):
|
||||
"""A full version of this test with all gymnasium envs is run in tests/envs/test_envs.py."""
|
||||
with warnings.catch_warnings(record=True) as caught_warnings:
|
||||
check_env(env)
|
||||
caught_warnings = [
|
||||
warning
|
||||
for warning in caught_warnings
|
||||
if str(warning.message) not in CHECK_ENV_IGNORE_WARNINGS
|
||||
]
|
||||
|
||||
assert len(caught_warnings) == 0, [warning.message for warning in caught_warnings]
|
||||
|
||||
|
Reference in New Issue
Block a user