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))
def test_or_else_on_failure_should_return_else(self): success = Success(1) self.assertEqual(Failure(Exception("e")).orElse(success), success)
def test_or_else_on_failure_should_throw_an_exception_default_is_not_try( self): self.assertRaises(TypeError, Failure(Exception("e")).orElse, 1)
def test_get_or_else_with_failure_should_return_else(self): self.assertEqual(Failure(Exception("e")).getOrElse(-1), -1)