Fixed #12146: Corrected Canadian postal code validation. Thanks paulschreiber and Mark Lavin.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11844 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey 2009-12-13 17:01:22 +00:00
parent 92eec3ef9a
commit 0fe8c20a28
2 changed files with 53 additions and 2 deletions

View file

@ -60,6 +60,50 @@ ValidationError: [u'Enter a postal code in the format XXX XXX.']
u''
>>> f.clean('')
u''
>>> f.clean('W2S 2H3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
>>> f.clean('T2W 2H7')
u'T2W 2H7'
>>> f.clean('T2S 2W7')
u'T2S 2W7'
>>> f.clean('Z2S 2H3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
>>> f.clean('T2Z 2H7')
u'T2Z 2H7'
>>> f.clean('T2S 2Z7')
u'T2S 2Z7'
>>> f.clean('F2S 2H3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
>>> f.clean('A2S 2D3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
>>> f.clean('A2I 2R3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
>>> f.clean('A2I 2R3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
>>> f.clean('A2Q 2R3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
>>> f.clean('U2B 2R3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
>>> f.clean('O2B 2R3')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXX XXX.']
# CAPhoneNumberField ##########################################################