2020-05-25 10:26:57 +02:00
|
|
|
import gym
|
|
|
|
import pytest
|
|
|
|
|
2020-06-24 11:44:47 +02:00
|
|
|
import mujoco_maze
|
|
|
|
|
2020-05-25 10:26:57 +02:00
|
|
|
|
2020-06-29 18:38:02 +02:00
|
|
|
@pytest.mark.parametrize("maze_id", mujoco_maze.TaskRegistry.keys())
|
2020-05-25 10:26:57 +02:00
|
|
|
def test_ant_maze(maze_id):
|
2020-07-06 16:16:34 +02:00
|
|
|
for i in range(2):
|
|
|
|
env = gym.make(f"Ant{maze_id}-v{i}")
|
2020-09-21 06:27:41 +02:00
|
|
|
s0 = env.reset()
|
2020-07-06 16:16:34 +02:00
|
|
|
s, _, _, _ = env.step(env.action_space.sample())
|
2020-09-21 06:27:41 +02:00
|
|
|
if not env.unwrapped._top_down_view:
|
|
|
|
assert s0.shape == (30,)
|
|
|
|
assert s.shape == (30,)
|
2020-05-25 10:26:57 +02:00
|
|
|
|
|
|
|
|
2020-06-29 18:38:02 +02:00
|
|
|
@pytest.mark.parametrize("maze_id", mujoco_maze.TaskRegistry.keys())
|
2020-05-25 10:26:57 +02:00
|
|
|
def test_point_maze(maze_id):
|
2020-07-06 16:16:34 +02:00
|
|
|
for i in range(2):
|
|
|
|
env = gym.make(f"Point{maze_id}-v{i}")
|
2020-09-21 06:27:41 +02:00
|
|
|
s0 = env.reset()
|
2020-07-06 16:16:34 +02:00
|
|
|
s, _, _, _ = env.step(env.action_space.sample())
|
2020-09-21 06:27:41 +02:00
|
|
|
if not env.unwrapped._top_down_view:
|
|
|
|
assert s0.shape == (7,)
|
|
|
|
assert s.shape == (7,)
|
2020-09-16 18:27:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("v", [0, 1])
|
|
|
|
def test_maze_args(v):
|
2020-09-24 10:41:49 +02:00
|
|
|
env = gym.make(f"PointTRoom-v{v}", task_kwargs={"goals": [(-2.0, -3.0)]})
|
2020-09-16 18:27:38 +02:00
|
|
|
assert env.reset().shape == (7,)
|
|
|
|
s, _, _, _ = env.step(env.action_space.sample())
|
|
|
|
assert s.shape == (7,)
|