From 0b1f4e3c7beb6f205515f11f443aa8ae99e07656 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Fri, 14 Sep 2007 02:01:11 +0000 Subject: Refs #5370 -- Added tests for ValidationError messages. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6150 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/util.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/regressiontests/forms/util.py (limited to 'tests/regressiontests/forms/util.py') diff --git a/tests/regressiontests/forms/util.py b/tests/regressiontests/forms/util.py new file mode 100644 index 0000000000..b0b50e3be9 --- /dev/null +++ b/tests/regressiontests/forms/util.py @@ -0,0 +1,33 @@ +# coding: utf-8 +""" +Tests for newforms/util.py module. +""" + +util_tests = r""" +>>> from django.newforms.util import * +>>> from django.utils.translation import ugettext_lazy + +################### +# ValidationError # +################### + +# Can take a string. +>>> print ValidationError("There was an error.").messages + + +# Can take a unicode string. +>>> print ValidationError(u"Not \u03C0.").messages + + +# Can take a lazy string. +>>> print ValidationError(ugettext_lazy("Error.")).messages + + +# Can take a list. +>>> print ValidationError(["Error one.", "Error two."]).messages + + +# Can take a mixture in a list. +>>> print ValidationError(["First error.", u"Not \u03C0.", ugettext_lazy("Error.")]).messages + +""" -- cgit v1.3