فهرست منبع

fix pre-commit

saleml 2 سال پیش
والد
کامیت
a4f1f04f91
3فایلهای تغییر یافته به همراه11 افزوده شده و 4 حذف شده
  1. 1 0
      gym_minigrid/wrappers.py
  2. 9 3
      tests/test_envs.py
  3. 1 1
      tests/test_wrappers.py

+ 1 - 0
gym_minigrid/wrappers.py

@@ -30,6 +30,7 @@ class ReseedWrapper(Wrapper):
     def step(self, action):
         return self.env.step(action)
 
+
 class ActionBonus(gym.Wrapper):
     """
     Wrapper which adds an exploration bonus.

+ 9 - 3
tests/test_envs.py

@@ -83,11 +83,17 @@ def test_env_determinism_rollout(env_spec: EnvSpec):
         )  # obs_2 verified by previous assertion
 
         assert rew_1 == rew_2, f"[{time_step}] reward 1={rew_1}, reward 2={rew_2}"
-        assert terminated_1 == terminated_2, f"[{time_step}] terminated 1={terminated_1}, terminated 2={terminated_2}"
-        assert truncated_1 == truncated_2, f"[{time_step}] truncated 1={truncated_1}, truncated 2={truncated_2}"
+        assert (
+            terminated_1 == terminated_2
+        ), f"[{time_step}] terminated 1={terminated_1}, terminated 2={terminated_2}"
+        assert (
+            truncated_1 == truncated_2
+        ), f"[{time_step}] truncated 1={truncated_1}, truncated 2={truncated_2}"
         assert_equals(info_1, info_2, f"[{time_step}] ")
 
-        if terminated_1 or truncated_1:  # terminated_2 and truncated_2 verified by previous assertion
+        if (
+            terminated_1 or truncated_1
+        ):  # terminated_2 and truncated_2 verified by previous assertion
             env_1.reset(seed=SEED)
             env_2.reset(seed=SEED)
 

+ 1 - 1
tests/test_wrappers.py

@@ -107,7 +107,7 @@ def test_state_bonus_wrapper(env_id):
 @pytest.mark.parametrize("env_id", ["MiniGrid-Empty-16x16-v0"])
 def test_action_bonus_wrapper(env_id):
     env = gym.make(env_id, new_step_api=True)
-    wrapped_env = ActionBonus(gym.make(env_id, new_step_api = True))
+    wrapped_env = ActionBonus(gym.make(env_id, new_step_api=True))
 
     action = MiniGridEnv.Actions.forward