Django

Code

root/django/trunk/tests/regressiontests/forms/localflavor/za.py

Revision 7294, 1.2 kB (checked in by mtredinnick, 9 months ago)

Added "svn:eol-style native" to every text file in the tree (*.txt, *.html,
*.py, *.xml and AUTHORS, etc). Added "svn:ignore *.pyc" to some directories in
tests/regressiontests/ that were previously missing it.

Fixed #6545, #6801.

  • Property svn:eol-style set to native
Line 
1 tests = r"""
2 # ZAIDField #################################################################
3
4 ZAIDField validates that the date is a valid birthdate and that the value
5 has a valid checksum. It allows spaces and dashes, and returns a plain
6 string of digits.
7 >>> from django.contrib.localflavor.za.forms import ZAIDField
8 >>> f = ZAIDField()
9 >>> f.clean('0002290001003')
10 '0002290001003'
11 >>> f.clean('000229 0001 003')
12 '0002290001003'
13 >>> f.clean('0102290001001')
14 Traceback (most recent call last):
15 ...
16 ValidationError: [u'Enter a valid South African ID number']
17 >>> f.clean('811208')
18 Traceback (most recent call last):
19 ...
20 ValidationError: [u'Enter a valid South African ID number']
21 >>> f.clean('0002290001004')
22 Traceback (most recent call last):
23 ...
24 ValidationError: [u'Enter a valid South African ID number']
25
26 # ZAPostCodeField ###########################################################
27 >>> from django.contrib.localflavor.za.forms import ZAPostCodeField
28 >>> f = ZAPostCodeField()
29 >>> f.clean('abcd')
30 Traceback (most recent call last):
31 ...
32 ValidationError: [u'Enter a valid South African postal code']
33 >>> f.clean('0000')
34 u'0000'
35 >>> f.clean(' 7530')
36 Traceback (most recent call last):
37 ...
38 ValidationError: [u'Enter a valid South African postal code']
39
40 """
Note: See TracBrowser for help on using the browser.