summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms/util.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-11-16 13:20:56 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-11-16 13:20:56 +0000
commit8bafde1229fdebb48383449de9bcadde06451816 (patch)
tree6f4c0965c5b2fef6309d52022fcad32e2144da48 /tests/regressiontests/forms/util.py
parent8da8d6c586bdbd086c3d76930fe32476a8438f19 (diff)
Migrated forms (minus localflavor) doctests. A huge thanks to Daniel Lindsley for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14570 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms/util.py')
-rw-r--r--tests/regressiontests/forms/util.py60
1 files changed, 0 insertions, 60 deletions
diff --git a/tests/regressiontests/forms/util.py b/tests/regressiontests/forms/util.py
deleted file mode 100644
index f365c8c1ae..0000000000
--- a/tests/regressiontests/forms/util.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# coding: utf-8
-"""
-Tests for forms/util.py module.
-"""
-
-tests = r"""
->>> from django.forms.util import *
->>> from django.core.exceptions import ValidationError
->>> from django.utils.translation import ugettext_lazy
-
-###########
-# flatatt #
-###########
-
->>> from django.forms.util import flatatt
->>> flatatt({'id': "header"})
-u' id="header"'
->>> flatatt({'class': "news", 'title': "Read this"})
-u' class="news" title="Read this"'
->>> flatatt({})
-u''
-
-###################
-# ValidationError #
-###################
-
-# Can take a string.
->>> print ErrorList(ValidationError("There was an error.").messages)
-<ul class="errorlist"><li>There was an error.</li></ul>
-
-# Can take a unicode string.
->>> print ErrorList(ValidationError(u"Not \u03C0.").messages)
-<ul class="errorlist"><li>Not π.</li></ul>
-
-# Can take a lazy string.
->>> print ErrorList(ValidationError(ugettext_lazy("Error.")).messages)
-<ul class="errorlist"><li>Error.</li></ul>
-
-# Can take a list.
->>> print ErrorList(ValidationError(["Error one.", "Error two."]).messages)
-<ul class="errorlist"><li>Error one.</li><li>Error two.</li></ul>
-
-# Can take a mixture in a list.
->>> print ErrorList(ValidationError(["First error.", u"Not \u03C0.", ugettext_lazy("Error.")]).messages)
-<ul class="errorlist"><li>First error.</li><li>Not π.</li><li>Error.</li></ul>
-
->>> class VeryBadError:
-... def __unicode__(self): return u"A very bad error."
-
-# Can take a non-string.
->>> print ErrorList(ValidationError(VeryBadError()).messages)
-<ul class="errorlist"><li>A very bad error.</li></ul>
-
-# Escapes non-safe input but not input marked safe.
->>> example = 'Example of link: <a href="http://www.example.com/">example</a>'
->>> print ErrorList([example])
-<ul class="errorlist"><li>Example of link: &lt;a href=&quot;http://www.example.com/&quot;&gt;example&lt;/a&gt;</li></ul>
->>> print ErrorList([mark_safe(example)])
-<ul class="errorlist"><li>Example of link: <a href="http://www.example.com/">example</a></li></ul>
-"""