Block Maze
This commit is contained in:
+33
-6
@@ -10,7 +10,7 @@ def test_ant_maze(maze_id):
|
||||
env = gym.make(f"Ant{maze_id}-v{i}")
|
||||
s0 = env.reset()
|
||||
s, _, _, _ = env.step(env.action_space.sample())
|
||||
if not env.unwrapped._top_down_view:
|
||||
if not env.unwrapped._top_down_view and not env.unwrapped._observe_blocks:
|
||||
assert s0.shape == (30,)
|
||||
assert s.shape == (30,)
|
||||
|
||||
@@ -20,21 +20,41 @@ def test_point_maze(maze_id):
|
||||
for i in range(2):
|
||||
env = gym.make(f"Point{maze_id}-v{i}")
|
||||
s0 = env.reset()
|
||||
s, _, _, _ = env.step(env.action_space.sample())
|
||||
if not env.unwrapped._top_down_view:
|
||||
s, r, _, _ = env.step(env.action_space.sample())
|
||||
if not env.unwrapped._top_down_view and not env.unwrapped._observe_blocks:
|
||||
assert s0.shape == (7,)
|
||||
assert s.shape == (7,)
|
||||
if i == 0:
|
||||
assert r != 0.0
|
||||
else:
|
||||
assert r == env.unwrapped._task.PENALTY
|
||||
assert r < 0.0
|
||||
|
||||
|
||||
@pytest.mark.parametrize("maze_id", mujoco_maze.TaskRegistry.keys())
|
||||
def test_reacher_maze(maze_id):
|
||||
for inhibited in ["Fall", "Push", "Block"]:
|
||||
if inhibited in maze_id:
|
||||
return
|
||||
for i in range(2):
|
||||
env = gym.make(f"Reacher{maze_id}-v{i}")
|
||||
s0 = env.reset()
|
||||
s, _, _, _ = env.step(env.action_space.sample())
|
||||
if not env.unwrapped._top_down_view and not env.unwrapped._observe_blocks:
|
||||
assert s0.shape == (9,)
|
||||
assert s.shape == (9,)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("maze_id", mujoco_maze.TaskRegistry.keys())
|
||||
def test_swimmer_maze(maze_id):
|
||||
if "Fall" in maze_id or "Push" in maze_id:
|
||||
return
|
||||
for inhibited in ["Fall", "Push", "Block"]:
|
||||
if inhibited in maze_id:
|
||||
return
|
||||
for i in range(2):
|
||||
env = gym.make(f"Swimmer{maze_id}-v{i}")
|
||||
s0 = env.reset()
|
||||
s, _, _, _ = env.step(env.action_space.sample())
|
||||
if not env.unwrapped._top_down_view:
|
||||
if not env.unwrapped._top_down_view and not env.unwrapped._observe_blocks:
|
||||
assert s0.shape == (11,)
|
||||
assert s.shape == (11,)
|
||||
|
||||
@@ -45,3 +65,10 @@ def test_maze_args(v):
|
||||
assert env.reset().shape == (7,)
|
||||
s, _, _, _ = env.step(env.action_space.sample())
|
||||
assert s.shape == (7,)
|
||||
|
||||
|
||||
def test_getting_movable(v):
|
||||
env = gym.make("PointBlockMaze-v1")
|
||||
assert env.reset().shape == (7,)
|
||||
s, _, _, _ = env.step(env.action_space.sample())
|
||||
assert s.shape == (7,)
|
||||
|
||||
Reference in New Issue
Block a user