Ticket #3957: tests_br_cpffield.diff

File tests_br_cpffield.diff, 2.0 KB (added by danielvaz@…, 18 years ago)
  • tests/regressiontests/forms/localflavor.py

     
    800800>>> f.clean('12345-123')
    801801u'12345-123'
    802802
     803# BRCPFField #################################################################
     804
     805>>> from django.contrib.localflavor.br.forms import BRCPFField
     806>>> f = BRCPFField()
     807>>> f.clean('')
     808Traceback (most recent call last):
     809...
     810ValidationError: [u'This field is required.']
     811>>> f.clean(None)
     812Traceback (most recent call last):
     813...
     814ValidationError: [u'This field is required.']
     815>>> f.clean('489.294.654-54')
     816Traceback (most recent call last):
     817...
     818ValidationError: [u'Invalid CPF number.']
     819>>> f.clean('295.669.575-98')
     820Traceback (most recent call last):
     821...
     822ValidationError: [u'Invalid CPF number.']
     823>>> f.clean('539.315.127-22')
     824Traceback (most recent call last):
     825...
     826ValidationError: [u'Invalid CPF number.']
     827>>> f.clean('663.256.017-26')
     828u'663.256.017-26'
     829>>> f.clean('66325601726')
     830u'66325601726'
     831>>> f.clean('375.788.573-20')
     832u'375.788.573-20'
     833>>> f.clean('84828509895')
     834u'84828509895'
     835>>> f.clean('375.788.573-XX')
     836Traceback (most recent call last):
     837...
     838ValidationError: [u'This field requires only numbers']
     839>>> f.clean('375.788.573-000')
     840Traceback (most recent call last):
     841...
     842ValidationError: [u'Ensure this value has at most 14 characters.']
     843>>> f.clean('123.456.78')
     844Traceback (most recent call last):
     845...
     846ValidationError: [u'Ensure this value has at least 11 characters.']
     847>>> f.clean('123456789555')
     848Traceback (most recent call last):
     849...
     850ValidationError: [u'This field requires at most 11 digits or 14 characters.']
     851>>> f = BRCPFField(required=False)
     852>>> f.clean('')
     853u''
     854>>> f.clean(None)
     855u''
     856
    803857# BRPhoneNumberField #########################################################
    804858
    805859>>> from django.contrib.localflavor.br.forms import BRPhoneNumberField
Back to Top