~ubuntu-branches/ubuntu/quantal/python-django/quantal

« back to all changes in this revision

Viewing changes to tests/regressiontests/forms/localflavor/za.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2008-11-15 19:15:33 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20081115191533-xbt1ut2xf4fvwtvc
Tags: 1.0.1-0ubuntu1
* New upstream release:
  - Bug fixes.

* The tests/ sub-directory appaers to have been dropped upstream, so pull
  our patch to workaround the tests and modify the rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
"""