def test_should_repr_as_expected_an_error_with_message(): given_any_message = "any message" class ErrorWithMessage(Error): def __init__(self, message: str): self.message = message result = Result(failure=ErrorWithMessage(given_any_message)) assert ( f"Result[status: failure | value: ErrorWithMessage: {given_any_message}]" == result.__repr__())
def test_should_repr_as_expected_default_error(): result = Result(failure=Error()) assert "Result[status: failure | value: Error]" == result.__repr__()
def test_should_repr_a_failure_result(): result = Result(failure=Error()) assert "Result[status: failure | value: Error]" == result.__repr__()
def test_should_repr_a_success_result(): result = Result(success=2) assert "Result[status: success | value: 2]" == result.__repr__()