diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-11-16 13:20:56 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-11-16 13:20:56 +0000 |
| commit | 8bafde1229fdebb48383449de9bcadde06451816 (patch) | |
| tree | 6f4c0965c5b2fef6309d52022fcad32e2144da48 /tests/regressiontests/forms/util.py | |
| parent | 8da8d6c586bdbd086c3d76930fe32476a8438f19 (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.py | 60 |
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: <a href="http://www.example.com/">example</a></li></ul> ->>> print ErrorList([mark_safe(example)]) -<ul class="errorlist"><li>Example of link: <a href="http://www.example.com/">example</a></li></ul> -""" |
