Skip to content

Commit

Permalink
[1.2.X] Converted Kuwaiti localflavor doctests to unittests. We have …
Browse files Browse the repository at this point in the history
…always been at war with doctests. Thanks to Idan Gazit. Backport of [14947].

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
alex committed Dec 18, 2010
1 parent 5c3ede2 commit 771ffbf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
31 changes: 16 additions & 15 deletions tests/regressiontests/forms/localflavor/kw.py
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*- from django.contrib.localflavor.kw.forms import KWCivilIDNumberField
# Tests for the contrib/localflavor/ KW form fields.

from utils import LocalFlavorTestCase
tests = r"""
# KWCivilIDNumberField ########################################################
class KWLocalFlavorTests(LocalFlavorTestCase):
>>> from django.contrib.localflavor.kw.forms import KWCivilIDNumberField def test_KWCivilIDNumberField(self):
>>> f = KWCivilIDNumberField() error_invalid = [u'Enter a valid Kuwaiti Civil ID number']
>>> f.clean('282040701483') valid = {
'282040701483' '282040701483': '282040701483',
>>> f.clean('289332013455') }
Traceback (most recent call last): invalid = {
... '289332013455': error_invalid,
ValidationError: [u'Enter a valid Kuwaiti Civil ID number'] }
""" self.assertFieldOutput(KWCivilIDNumberField, valid, invalid)

3 changes: 1 addition & 2 deletions tests/regressiontests/forms/localflavortests.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from localflavor.cz import tests as localflavor_cz_tests from localflavor.cz import tests as localflavor_cz_tests
from localflavor.kw import tests as localflavor_kw_tests
from localflavor.nl import tests as localflavor_nl_tests from localflavor.nl import tests as localflavor_nl_tests
from localflavor.pl import tests as localflavor_pl_tests from localflavor.pl import tests as localflavor_pl_tests
from localflavor.pt import tests as localflavor_pt_tests from localflavor.pt import tests as localflavor_pt_tests
Expand Down Expand Up @@ -30,11 +29,11 @@
from localflavor.is_ import ISLocalFlavorTests from localflavor.is_ import ISLocalFlavorTests
from localflavor.it import ITLocalFlavorTests from localflavor.it import ITLocalFlavorTests
from localflavor.jp import JPLocalFlavorTests from localflavor.jp import JPLocalFlavorTests
from localflavor.kw import KWLocalFlavorTests




__test__ = { __test__ = {
'localflavor_cz_tests': localflavor_cz_tests, 'localflavor_cz_tests': localflavor_cz_tests,
'localflavor_kw_tests': localflavor_kw_tests,
'localflavor_nl_tests': localflavor_nl_tests, 'localflavor_nl_tests': localflavor_nl_tests,
'localflavor_pl_tests': localflavor_pl_tests, 'localflavor_pl_tests': localflavor_pl_tests,
'localflavor_pt_tests': localflavor_pt_tests, 'localflavor_pt_tests': localflavor_pt_tests,
Expand Down
1 change: 1 addition & 0 deletions tests/regressiontests/forms/tests/__init__.py
Expand Up @@ -30,4 +30,5 @@
ISLocalFlavorTests, ISLocalFlavorTests,
ITLocalFlavorTests, ITLocalFlavorTests,
JPLocalFlavorTests, JPLocalFlavorTests,
KWLocalFlavorTests,
) )

0 comments on commit 771ffbf

Please sign in to comment.