def test_puts_the_parameter_under_that_name_in_valid_parameters(self): assert_that( validate( conversion_of( 'kleur', 'red', ColorWithSuccessAttributeSupport)).map(lambda p: p.kleur), equal_to(ColorWithSuccessAttributeSupport('red')))
def test_returns_success_when_value_is_present(self): assert_that( validate(presence_of('some_parameter', 'value')).map(lambda p: p.some_parameter), equal_to('value'))
def validate(self, email): return validate(email_validity_of( 'email_parameter', email)).map(lambda p: p.email_parameter)
def test_can_fail_a_conversion_that_potentially_returns_failure(self): assert_that( validate(conversion_of('color', 'xx', Color)).map(lambda p: p.color), equal_to(Failure(message='uh oh')))
def test_validates_a_conversion_that_potentially_returns_failure(self): assert_that( validate(conversion_of('color', 'red', Color)).map(lambda p: p.color), equal_to(Color('red')))
def test_returns_failure_when_value_is_not_present(self): assert_that( validate(presence_of('some_parameter', None)).map(lambda p: p.some_parameter), equal_to(Failure(message='some_parameter is missing')))