Exemplo n.º 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))
Exemplo n.º 2
0
 def test_or_else_on_failure_should_return_else(self):
     success = Success(1)
     self.assertEqual(Failure(Exception("e")).orElse(success), success)
Exemplo n.º 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)
Exemplo n.º 4
0
 def test_get_or_else_with_failure_should_return_else(self):
     self.assertEqual(Failure(Exception("e")).getOrElse(-1), -1)