From 9a35f2a99d50ed6732931b193d975958a7bba1d2 Mon Sep 17 00:00:00 2001
From: flaurent <florian.laurent@gmail.com>
Date: Sun, 7 Jun 2020 17:54:33 +0200
Subject: [PATCH] Fixed tests following malfunction rate fix

---
 tests/test_flatland_malfunction.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/test_flatland_malfunction.py b/tests/test_flatland_malfunction.py
index 464e7523..eaa31127 100644
--- a/tests/test_flatland_malfunction.py
+++ b/tests/test_flatland_malfunction.py
@@ -119,9 +119,9 @@ def test_malfunction_process():
 
 
 def test_malfunction_process_statistically():
-    """Tests hat malfunctions are produced by stochastic_data!"""
+    """Tests that malfunctions are produced by stochastic_data!"""
     # Set fixed malfunction duration for this test
-    stochastic_data = MalfunctionParameters(malfunction_rate=5,  # Rate of malfunction occurence
+    stochastic_data = MalfunctionParameters(malfunction_rate=1/5,  # Rate of malfunction occurence
                                             min_duration=5,  # Minimal duration of malfunction
                                             max_duration=5  # Max duration of malfunction
                                             )
@@ -168,7 +168,7 @@ def test_malfunction_process_statistically():
 def test_malfunction_before_entry():
     """Tests that malfunctions are working properly for agents before entering the environment!"""
     # Set fixed malfunction duration for this test
-    stochastic_data = MalfunctionParameters(malfunction_rate=2,  # Rate of malfunction occurence
+    stochastic_data = MalfunctionParameters(malfunction_rate=1/2,  # Rate of malfunction occurrence
                                             min_duration=10,  # Minimal duration of malfunction
                                             max_duration=10  # Max duration of malfunction
                                             )
@@ -215,7 +215,7 @@ def test_malfunction_values_and_behavior():
 
     rail, rail_map = make_simple_rail2()
     action_dict: Dict[int, RailEnvActions] = {}
-    stochastic_data = MalfunctionParameters(malfunction_rate=0.001,  # Rate of malfunction occurence
+    stochastic_data = MalfunctionParameters(malfunction_rate=1/0.001,  # Rate of malfunction occurence
                                             min_duration=10,  # Minimal duration of malfunction
                                             max_duration=10  # Max duration of malfunction
                                             )
@@ -241,7 +241,7 @@ def test_malfunction_values_and_behavior():
 
 
 def test_initial_malfunction():
-    stochastic_data = MalfunctionParameters(malfunction_rate=1000,  # Rate of malfunction occurence
+    stochastic_data = MalfunctionParameters(malfunction_rate=1/1000,  # Rate of malfunction occurence
                                             min_duration=2,  # Minimal duration of malfunction
                                             max_duration=5  # Max duration of malfunction
                                             )
@@ -390,7 +390,7 @@ def test_initial_malfunction_stop_moving():
 
 
 def test_initial_malfunction_do_nothing():
-    stochastic_data = MalfunctionParameters(malfunction_rate=70,  # Rate of malfunction occurence
+    stochastic_data = MalfunctionParameters(malfunction_rate=1/70,  # Rate of malfunction occurence
                                             min_duration=2,  # Minimal duration of malfunction
                                             max_duration=5  # Max duration of malfunction
                                             )
-- 
GitLab