def test_cartpole_contextual():
env_id = 'CartPoleContextual-v0'
env = gym.make(env_id)
if isinstance(env.unwrapped, CartPoleEnv):
env.reset()
else:
raise NotImplementedError
nr_of_items_context_space_info = 10
nr_unwrapped = len(list(env.unwrapped.context_space_info().keys()))
if nr_of_items_context_space_info != nr_unwrapped:
print('context_space_info() function needs to be implemented!')
raise NotImplementedError
context_vect = [0.01, 0.01, 0.01, 0.01]
# these should change because change_context_function
if context_vect == env.unwrapped.context:
raise AttributeError
env.unwrapped.change_context(context_vect)
if context_vect != env.unwrapped.context:
raise AttributeError
评论列表
文章目录