Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ale/python/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ def __init__(
raise error.Error(
f"Invalid stochastic frameskip length of {len(frameskip)}, expected length 2."
)
elif isinstance(frameskip, tuple) and frameskip[0] > frameskip[1]:
elif isinstance(frameskip, tuple) and frameskip[0] >= frameskip[1]:
raise error.Error(
"Invalid stochastic frameskip, lower bound is greater than upper bound."
"Invalid stochastic frameskip, lower bound must be strictly less than upper bound."
)
elif isinstance(frameskip, tuple) and frameskip[0] <= 0:
raise error.Error(
"Invalid stochastic frameskip lower bound is greater than upper bound."
"Invalid stochastic frameskip, lower bound must be positive."
)

if render_mode is not None and render_mode not in {"rgb_array", "human"}:
Expand Down
4 changes: 3 additions & 1 deletion tests/python/test_atari_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ def test_gym_reset_with_infos(tetris_env):
assert "frame_number" in info


@pytest.mark.parametrize("frameskip", [0, -1, 4.0, (-1, 5), (0, 5), (5, 2), (1, 2, 3)])
@pytest.mark.parametrize(
"frameskip", [0, -1, 4.0, (-1, 5), (0, 5), (5, 2), (4, 4), (1, 2, 3)]
)
def test_frameskip_warnings(tetris_rom_path, frameskip):
with patch("ale_py.roms.Tetris", create=True, new_callable=lambda: tetris_rom_path):
with pytest.raises(gymnasium.error.Error):
Expand Down
Loading