Logo
Explore Help
Sign In
gaspersic/Gymnasium
1
0
Fork 0
You've already forked Gymnasium
mirror of https://github.com/Farama-Foundation/Gymnasium.git synced 2025-09-04 11:16:54 +00:00
Code Issues Packages Projects Releases Wiki Activity
Files
e4a77b381e15db4ad16bf388c2b51cca1d46ca90
Gymnasium/gym/tests/test_core.py

16 lines
353 B
Python
Raw Normal View History

Improve closer implementation and docstrings (#126) * Improve auto close implementation - Register all envs at initialization time, not just ones created via make - Simplify names and add more documentation on interface - Move closer instances into the relevant modules review-requested: @jietang * Close environments in the tests This isn't strictly needed, but means there are fewer Doom subprocesses hanging around while the tests run. * Use 4 space indent in comment * Improve docstrings in core * Don't pass through args to __new__ The __init__ method gets called once __new__ returns, so these arguments are either ignored (Python 2) or result in an error (Python 3). The __init__ method automatically gets called with the correct arguments. * Fixup comments
2016-05-27 12:16:35 -07:00
from gym import core
class ArgumentEnv(core.Env):
calls = 0
def __init__(self, arg):
self.calls += 1
self.arg = arg
def test_env_instantiation():
# This looks like a pretty trivial, but given our usage of
# __new__, it's worth having.
env = ArgumentEnv('arg')
assert env.arg == 'arg'
assert env.calls == 1
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.5 Page: 42ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API