summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-14 16:06:27 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-14 16:06:27 +0000
commitfbfefbf83d1396db1ea4095b2b64e1841689b364 (patch)
treed2eb31ada06c261b5dec94ab20fc3a487ba5815a /tests
parent3916cfbaff3b0b41d977a5efb6a9d9b41b067d90 (diff)
downloaddjango-fbfefbf83d1396db1ea4095b2b64e1841689b364.tar.gz
unicode: Changed a few more places in newforms where str() was being used with
potential non-ASCII arguments. Refs #3406 (and added a test for the latter). git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5236 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/forms/regressions.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/regressions.py b/tests/regressiontests/forms/regressions.py
index c5a94db6f9..caa0f68741 100644
--- a/tests/regressiontests/forms/regressions.py
+++ b/tests/regressiontests/forms/regressions.py
@@ -36,4 +36,14 @@ Unicode decoding problems...
>>> f = SomeForm()
>>> f.as_p()
u'<p><label for="id_somechoice_0">\xc5\xf8\xdf:</label> <ul>\n<li><label><input type="radio" id="id_somechoice_0" value="\xc5" name="somechoice" /> En tied\xe4</label></li>\n<li><label><input type="radio" id="id_somechoice_1" value="\xf8" name="somechoice" /> Mies</label></li>\n<li><label><input type="radio" id="id_somechoice_2" value="\xdf" name="somechoice" /> Nainen</label></li>\n</ul></p>'
+
+Testing choice validation with UTF-8 bytestrings as input (these are the
+Russian abbreviations "мес." and "шт.".
+
+>>> UNITS = (('\xd0\xbc\xd0\xb5\xd1\x81.', '\xd0\xbc\xd0\xb5\xd1\x81.'), ('\xd1\x88\xd1\x82.', '\xd1\x88\xd1\x82.'))
+>>> f = ChoiceField(choices=UNITS)
+>>> f.clean(u'\u0448\u0442.')
+u'\u0448\u0442.'
+>>> f.clean('\xd1\x88\xd1\x82.')
+u'\u0448\u0442.'
"""