Django

Code

Changeset 5108

Show
Ignore:
Timestamp:
04/27/07 07:50:24 (2 years ago)
Author:
mtredinnick
Message:

Added tests for Brazilian CRPF field that were accidentally omitted in [5089].
Refs #3957.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/forms/localflavor.py

    r5099 r5108  
    875875u'' 
    876876 
     877# BRCPFField ################################################################# 
     878 
     879>>> from django.contrib.localflavor.br.forms import BRCPFField 
     880>>> f = BRCPFField() 
     881>>> f.clean('') 
     882Traceback (most recent call last): 
     883... 
     884ValidationError: [u'This field is required.'] 
     885>>> f.clean(None) 
     886Traceback (most recent call last): 
     887... 
     888ValidationError: [u'This field is required.'] 
     889>>> f.clean('489.294.654-54') 
     890Traceback (most recent call last): 
     891... 
     892ValidationError: [u'Invalid CPF number.'] 
     893>>> f.clean('295.669.575-98') 
     894Traceback (most recent call last): 
     895... 
     896ValidationError: [u'Invalid CPF number.'] 
     897>>> f.clean('539.315.127-22') 
     898Traceback (most recent call last): 
     899... 
     900ValidationError: [u'Invalid CPF number.'] 
     901>>> f.clean('663.256.017-26') 
     902u'663.256.017-26' 
     903>>> f.clean('66325601726') 
     904u'66325601726' 
     905>>> f.clean('375.788.573-20') 
     906u'375.788.573-20' 
     907>>> f.clean('84828509895') 
     908u'84828509895' 
     909>>> f.clean('375.788.573-XX') 
     910Traceback (most recent call last): 
     911... 
     912ValidationError: [u'This field requires only numbers.'] 
     913>>> f.clean('375.788.573-000') 
     914Traceback (most recent call last): 
     915... 
     916ValidationError: [u'Ensure this value has at most 14 characters.'] 
     917>>> f.clean('123.456.78') 
     918Traceback (most recent call last): 
     919... 
     920ValidationError: [u'Ensure this value has at least 11 characters.'] 
     921>>> f.clean('123456789555') 
     922Traceback (most recent call last): 
     923... 
     924ValidationError: [u'This field requires at most 11 digits or 14 characters.'] 
     925>>> f = BRCPFField(required=False) 
     926>>> f.clean('') 
     927u'' 
     928>>> f.clean(None) 
     929u'' 
     930 
    877931# BRPhoneNumberField ######################################################### 
    878932