summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2007-12-15 01:38:43 +0000
committerJustin Bronn <jbronn@gmail.com>2007-12-15 01:38:43 +0000
commit34560a01daee3c42a7c5ec462f38a485cccf4df7 (patch)
treec332688943fb10b1503654815a06093c1d52e493 /tests/regressiontests/forms
parent5799c2e048ff829300af88ae839de20e1763ee1d (diff)
gis: Merged revisions 6672,6686-6688,6690,6693,6707-6708,6726,6730,6753,6755-6762,6764,6776-6777,6779,6782-6919 via svnmerge from trunk; reverted oracle backend `base.py` due to ikelly's patch in r6905.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6920 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms')
-rw-r--r--tests/regressiontests/forms/localflavor/za.py40
-rw-r--r--tests/regressiontests/forms/tests.py2
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/localflavor/za.py b/tests/regressiontests/forms/localflavor/za.py
new file mode 100644
index 0000000000..a948964b8d
--- /dev/null
+++ b/tests/regressiontests/forms/localflavor/za.py
@@ -0,0 +1,40 @@
+tests = r"""
+# ZAIDField #################################################################
+
+ZAIDField validates that the date is a valid birthdate and that the value
+has a valid checksum. It allows spaces and dashes, and returns a plain
+string of digits.
+>>> from django.contrib.localflavor.za.forms import ZAIDField
+>>> f = ZAIDField()
+>>> f.clean('0002290001003')
+'0002290001003'
+>>> f.clean('000229 0001 003')
+'0002290001003'
+>>> f.clean('0102290001001')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a valid South African ID number']
+>>> f.clean('811208')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a valid South African ID number']
+>>> f.clean('0002290001004')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a valid South African ID number']
+
+# ZAPostCodeField ###########################################################
+>>> from django.contrib.localflavor.za.forms import ZAPostCodeField
+>>> f = ZAPostCodeField()
+>>> f.clean('abcd')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a valid South African postal code']
+>>> f.clean('0000')
+u'0000'
+>>> f.clean(' 7530')
+Traceback (most recent call last):
+...
+ValidationError: [u'Enter a valid South African postal code']
+
+"""
diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py
index 6acd4f2e1d..bb0e30b874 100644
--- a/tests/regressiontests/forms/tests.py
+++ b/tests/regressiontests/forms/tests.py
@@ -22,6 +22,7 @@ from localflavor.pl import tests as localflavor_pl_tests
from localflavor.sk import tests as localflavor_sk_tests
from localflavor.uk import tests as localflavor_uk_tests
from localflavor.us import tests as localflavor_us_tests
+from localflavor.za import tests as localflavor_za_tests
from regressions import tests as regression_tests
from util import tests as util_tests
from widgets import tests as widgets_tests
@@ -50,6 +51,7 @@ __test__ = {
'localflavor_sk_tests': localflavor_sk_tests,
'localflavor_uk_tests': localflavor_uk_tests,
'localflavor_us_tests': localflavor_us_tests,
+ 'localflavor_za_tests': localflavor_za_tests,
'regression_tests': regression_tests,
'util_tests': util_tests,
'widgets_tests': widgets_tests,