Skip to content

Commit

Permalink
Add configured tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nottombrown committed Dec 28, 2016
1 parent 10f7e4f commit c3c703c
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions gym/wrappers/tests/test_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@ def test_skip():
obs = env.reset()
env.render()

def test_configured():
env = gym.make("FrozenLake-v0")
env = wrappers.TimeLimit(env)
env.configure()

# Make sure all layers of wrapping are configured
assert env._configured
assert env.env._configured
env.close()

def test_double_configured():
env = gym.make("FrozenLake-v0")
every_two_frame = SkipWrapper(2)
env = every_two_frame(env)

env = wrappers.TimeLimit(env)
env.configure()

# Make sure all layers of wrapping are configured
assert env._configured
assert env.env._configured
assert env.env.env._configured
env.close()

def test_no_double_wrapping():
temp = tempfile.mkdtemp()
Expand All @@ -29,7 +52,3 @@ def test_no_double_wrapping():
env.close()
finally:
shutil.rmtree(temp)


if __name__ == '__main__':
test_no_double_wrapping()

0 comments on commit c3c703c

Please sign in to comment.