<s> from django . utils . unittest import TestCase <EOL> from modeltests . validation import ValidationTestCase <EOL> from models import * <EOL> class TestModelsWithValidators ( ValidationTestCase ) : <EOL> def test_custom_validator_passes_for_correct_value ( self ) : <EOL> mtv = ModelToValidate ( number = <NUM_LIT:10> , name = '<STR_LIT>' , f_with_custom_validator = <NUM_LIT> ) <EOL> self . assertEqual ( None , mtv . full_clean ( ) ) <EOL> def test_custom_validator_raises_error_for_incorrect_value ( self ) : <EOL> mtv = ModelToValidate ( number = <NUM_LIT:10> , name = '<STR_LIT>' , f_with_custom_validator = <NUM_LIT:12> ) <EOL> self . assertFailsValidation ( mtv . full_clean , [ '<STR_LIT>' ] ) <EOL> self . assertFieldFailsValidationWithMessage ( <EOL> mtv . full_clean , <EOL> '<STR_LIT>' , <EOL> [ u'<STR_LIT>' ] <EOL> ) </s>
