Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
Signed-off-by: guillemdb <[email protected]>
  • Loading branch information
Guillemdb committed Sep 3, 2024
1 parent 98af4eb commit d825d48
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/plangym/videogames/nes.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def __setattr__(self, name, value):
if name == "_wrapped":
super().__setattr__(name, value)
else:
setattr(self._wrapped, name, value)
setattr(self._wrapped, name, value) # pragma: no cover

def __delattr__(self, name):
"""Delete an attribute from the wrapped object."""
delattr(self._wrapped, name)
delattr(self._wrapped, name) # pragma: no cover

def step(
self, action: ActType
Expand Down
15 changes: 13 additions & 2 deletions tests/videogames/test_nes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,16 @@ def env(request):
return request.param()


# class TestMarioEnv(TestPlangymEnv):
# pass
class TestMarioEnv:
def test_get_keys_to_action(self, env):
vals = env.gym_env.get_keys_to_action()
assert isinstance(vals, dict)

def test_get_action_meanings(self, env):
vals = env.gym_env.get_action_meanings()
assert isinstance(vals, list)

def test_buttons(self, env):
buttons = env.gym_env.buttons()
assert isinstance(buttons, list), buttons
assert all(isinstance(b, str) for b in buttons)

0 comments on commit d825d48

Please sign in to comment.