Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.2.X] Converted Kuwaiti localflavor doctests to unittests. We have …
…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
Showing
3 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters