예제 #1
0
 def test_ignores_whitespace_in_probability_variable(self):
     self.os.environ.get.return_value = " \n0.1 "
     p = chaos.get_default_probability()
     self.assertEqual(p, 0.1)
예제 #2
0
 def test_returns_default_if_no_probability_variable(self):
     self.os.environ.get.return_value = ""
     p = chaos.get_default_probability()
     self.assertEqual(p, chaos.DEFAULT_PROBABILITY)
예제 #3
0
 def test_returns_float_value_of_probability_variable(self):
     for s in ("0.1", "0.2", "0.3"):
         self.os.environ.get.return_value = s
         p = chaos.get_default_probability()
         self.assertEqual(p, float(s))
예제 #4
0
 def test_looks_for_a_probability_environment_variable(self):
     self.os.environ.get.return_value = ""
     chaos.get_default_probability()
     self.os.environ.get.assert_called_once_with("probability", "")
예제 #5
0
 def test_ignores_whitespace_in_probability_variable(self):
     self.os.environ.get.return_value = " \n0.1 "
     p = chaos.get_default_probability()
     self.assertEqual(p, 0.1)
예제 #6
0
 def test_returns_float_value_of_probability_variable(self):
     for s in ("0.1", "0.2", "0.3"):
         self.os.environ.get.return_value = s
         p = chaos.get_default_probability()
         self.assertEqual(p, float(s))
예제 #7
0
 def test_returns_default_if_no_probability_variable(self):
     self.os.environ.get.return_value = ""
     p = chaos.get_default_probability()
     self.assertEqual(p, chaos.DEFAULT_PROBABILITY)
예제 #8
0
 def test_looks_for_a_probability_environment_variable(self):
     self.os.environ.get.return_value = ""
     chaos.get_default_probability()
     self.os.environ.get.assert_called_once_with("probability", "")