浏览代码

Fixed the gym_unity tests (#1149)

/develop-generalizationTraining-TrainerController
Arthur Juliani 6 年前
当前提交
52958d1e
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 8
      gym-unity/tests/test_gym.py

8
gym-unity/tests/test_gym.py


from gym_unity.envs import UnityEnv, UnityGymException
from tests.mock_communicator import MockCommunicator
@mock.patch('unityagents.UnityEnvironment.executable_launcher')
@mock.patch('unityagents.UnityEnvironment.get_communicator')
@mock.patch('mlagents.envs.UnityEnvironment.executable_launcher')
@mock.patch('mlagents.envs.UnityEnvironment.get_communicator')
def test_gym_wrapper(mock_communicator, mock_launcher):
mock_communicator.return_value = MockCommunicator(
discrete_action=False, visual_inputs=0, stack=False, num_agents=1)

assert isinstance(done, bool)
assert isinstance(info, dict)
@mock.patch('unityagents.UnityEnvironment.executable_launcher')
@mock.patch('unityagents.UnityEnvironment.get_communicator')
@mock.patch('mlagents.envs.UnityEnvironment.executable_launcher')
@mock.patch('mlagents.envs.UnityEnvironment.get_communicator')
def test_multi_agent(mock_communicator, mock_launcher):
mock_communicator.return_value = MockCommunicator(
discrete_action=False, visual_inputs=0, stack=False, num_agents=2)

正在加载...
取消
保存