From a26ba33111a41d87eaea23b4ba2ae48be4e08b18 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 26 Jul 2008 04:25:42 +0000 Subject: Fixed #7686 -- Added an Austrian localflavor. Thanks, bernd. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8087 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/localflavor/at.py | 66 +++++++++++++++++++++++++++ tests/regressiontests/forms/tests.py | 2 + 2 files changed, 68 insertions(+) create mode 100644 tests/regressiontests/forms/localflavor/at.py (limited to 'tests/regressiontests/forms') diff --git a/tests/regressiontests/forms/localflavor/at.py b/tests/regressiontests/forms/localflavor/at.py new file mode 100644 index 0000000000..e7229012f0 --- /dev/null +++ b/tests/regressiontests/forms/localflavor/at.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +# Tests for the contrib/localflavor/ AT form fields. + +tests = r""" +# ATZipCodeField ########################################################### + +>>> from django.contrib.localflavor.at.forms import ATZipCodeField +>>> f = ATZipCodeField() +>>> f.clean('1150') +u'1150' +>>> f.clean('4020') +u'4020' +>>> f.clean('8020') +u'8020' +>>> f.clean('111222') +Traceback (most recent call last): +... +ValidationError: [u'Enter a zip code in the format XXXX.'] +>>> f.clean('eeffee') +Traceback (most recent call last): +... +ValidationError: [u'Enter a zip code in the format XXXX.'] +>>> f.clean(u'') +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] +>>> f.clean(None) +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] +>>> f.clean('') +Traceback (most recent call last): +... +ValidationError: [u'This field is required.'] + + +>>> f = ATZipCodeField(required=False) +>>> f.clean('1150') +u'1150' +>>> f.clean('4020') +u'4020' +>>> f.clean('8020') +u'8020' +>>> f.clean('111222') +Traceback (most recent call last): +... +ValidationError: [u'Enter a zip code in the format XXXX.'] +>>> f.clean('eeffee') +Traceback (most recent call last): +... +ValidationError: [u'Enter a zip code in the format XXXX.'] +>>> f.clean(None) +u'' +>>> f.clean('') +u'' +>>> f.clean(u'') +u'' + +# ATStateSelect ################################################################## + +>>> from django.contrib.localflavor.at.forms import ATStateSelect +>>> f = ATStateSelect() +>>> f.render('bundesland', 'WI') +u'' + +""" diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index f5ab34507d..6a8b017f44 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -4,6 +4,7 @@ from fields import tests as fields_tests from forms import tests as form_tests from error_messages import tests as custom_error_message_tests from localflavor.ar import tests as localflavor_ar_tests +from localflavor.at import tests as localflavor_at_tests from localflavor.au import tests as localflavor_au_tests from localflavor.br import tests as localflavor_br_tests from localflavor.ca import tests as localflavor_ca_tests @@ -36,6 +37,7 @@ __test__ = { 'form_tests': form_tests, 'custom_error_message_tests': custom_error_message_tests, 'localflavor_ar_tests': localflavor_ar_tests, + 'localflavor_at_tests': localflavor_at_tests, 'localflavor_au_tests': localflavor_au_tests, 'localflavor_br_tests': localflavor_br_tests, 'localflavor_ca_tests': localflavor_ca_tests, -- cgit v1.3