diff --git a/tests/vector/test_vector_wrapper.py b/tests/vector/test_vector_wrapper.py index 2701ecbb7..16dd82932 100644 --- a/tests/vector/test_vector_wrapper.py +++ b/tests/vector/test_vector_wrapper.py @@ -54,3 +54,17 @@ def test_vector_env_wrapper_attributes(): assert np.allclose(wrapped.env.get_attr("gravity"), env.get_attr("gravity")) env.close() + + +def test_vector_env_metadata(): + """Test if `metadata` property for VectorWrapper correctly forwards to the vector env it is wrapping.""" + env = gym.make_vec("CartPole-v1", num_envs=3, vectorization_mode="sync") + wrapped = DummyVectorWrapper( + gym.make_vec("CartPole-v1", num_envs=3, vectorization_mode="sync") + ) + + assert env.metadata == wrapped.metadata + env.metadata = {"render_modes": ["rgb_array"]} + assert env.metadata != wrapped.metadata + + env.close()