mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-01 22:11:25 +00:00
Fix play
assertion error (#132)
This commit is contained in:
@@ -51,7 +51,7 @@ class PlayableGame:
|
||||
zoom: If to zoom in on the environment render
|
||||
"""
|
||||
if env.render_mode not in {"rgb_array", "rgb_array_list"}:
|
||||
logger.error(
|
||||
raise ValueError(
|
||||
"PlayableGame wrapper works only with rgb_array and rgb_array_list render modes, "
|
||||
f"but your environment render_mode = {env.render_mode}."
|
||||
)
|
||||
|
@@ -206,4 +206,12 @@ def test_play_loop_real_env():
|
||||
|
||||
def test_play_no_keys():
|
||||
with pytest.raises(MissingKeysToAction):
|
||||
play(gym.make("CartPole-v1"))
|
||||
play(gym.make("CartPole-v1", render_mode="rgb_array"))
|
||||
|
||||
|
||||
def test_wrong_render_mode():
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
match=r"PlayableGame wrapper works only with rgb_array and rgb_array_list render modes",
|
||||
):
|
||||
play(gym.make("CartPole-v1"), keys_to_action={})
|
||||
|
Reference in New Issue
Block a user