Unicode in validators tests

46 views
Skip to first unread message

alois.g...@gmail.com

unread,
Apr 2, 2014, 6:43:23 AM4/2/14
to django-d...@googlegroups.com
Hi,

I was wondering if the test inputs in the validators tests should be given as unicode or python string. It seems to me that at the moment the validation is done, the string is already coded in unicode. However the django tests use a python string as test input (https://github.com/django/django/blob/master/tests/validators/tests.py).

Could someone help me to clarify this? (chances are I don't dig encoding enough)

Thanks,

Alois

Shai Berger

unread,
Apr 2, 2014, 8:46:59 AM4/2/14
to django-d...@googlegroups.com
On Wednesday 02 April 2014 13:43:23 alois.g...@gmail.com wrote:
> Hi,
>
> I was wondering if the test inputs in the validators tests should be given
> as unicode or python string. It seems to me that at the moment the
> validation is done, the string is already coded in unicode. However the
> django tests use a python string as test input
> (https://github.com/django/django/blob/master/tests/validators/tests.py).
>

They are "text" (=unicode) objects, not "bytes".

Notice line 2 in that file:

from __future__ import unicode_literals

You may want to look up the whole issue of strings, bytes and unicode in
Python2 and Python3.

HTH,
Shai.
Reply all
Reply to author
Forward
0 new messages