Beispiel #1
0
 def test_failed_on_failure_should_return_success_of_exception(self):
     result = Failure(Exception("e")).failed()
     self.assertTrue(result.isSuccess
                     and isinstance(result.get(), Exception))
Beispiel #2
0
 def test_or_else_on_failure_should_return_else(self):
     success = Success(1)
     self.assertEqual(Failure(Exception("e")).orElse(success), success)
Beispiel #3
0
 def test_or_else_on_failure_should_throw_an_exception_default_is_not_try(
         self):
     self.assertRaises(TypeError, Failure(Exception("e")).orElse, 1)
Beispiel #4
0
 def test_get_or_else_with_failure_should_return_else(self):
     self.assertEqual(Failure(Exception("e")).getOrElse(-1), -1)