summaryrefslogtreecommitdiff
path: root/tests/regressiontests/model_forms_regress/tests.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-07-20 14:48:51 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-07-22 09:29:54 +0200
commitbdca5ea345c548a82a80d198906818c9ccbef896 (patch)
tree5c3f5fe5ad2522175d67b96a1fce1ff1763ba125 /tests/regressiontests/model_forms_regress/tests.py
parent3cb2457f46b3e40ff6b6acffcb3fd44cbea091e5 (diff)
downloaddjango-bdca5ea345c548a82a80d198906818c9ccbef896.tar.gz
[py3] Replaced unicode/str by six.text_type/bytes.
Diffstat (limited to 'tests/regressiontests/model_forms_regress/tests.py')
-rw-r--r--tests/regressiontests/model_forms_regress/tests.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/regressiontests/model_forms_regress/tests.py b/tests/regressiontests/model_forms_regress/tests.py
index a0f9bba170..3cb129f84e 100644
--- a/tests/regressiontests/model_forms_regress/tests.py
+++ b/tests/regressiontests/model_forms_regress/tests.py
@@ -7,6 +7,7 @@ from django.core.exceptions import FieldError, ValidationError
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms.models import (modelform_factory, ModelChoiceField,
fields_for_model, construct_instance, ModelFormMetaclass)
+from django.utils import six
from django.utils import unittest
from django.test import TestCase
@@ -392,14 +393,14 @@ class FileFieldTests(unittest.TestCase):
"""
form = DocumentForm()
- self.assertTrue('name="myfile"' in unicode(form))
- self.assertTrue('myfile-clear' not in unicode(form))
+ self.assertTrue('name="myfile"' in six.text_type(form))
+ self.assertTrue('myfile-clear' not in six.text_type(form))
form = DocumentForm(files={'myfile': SimpleUploadedFile('something.txt', b'content')})
self.assertTrue(form.is_valid())
doc = form.save(commit=False)
self.assertEqual(doc.myfile.name, 'something.txt')
form = DocumentForm(instance=doc)
- self.assertTrue('myfile-clear' in unicode(form))
+ self.assertTrue('myfile-clear' in six.text_type(form))
form = DocumentForm(instance=doc, data={'myfile-clear': 'true'})
doc = form.save(commit=False)
self.assertEqual(bool(doc.myfile), False)
@@ -420,7 +421,7 @@ class FileFieldTests(unittest.TestCase):
self.assertTrue(not form.is_valid())
self.assertEqual(form.errors['myfile'],
['Please either submit a file or check the clear checkbox, not both.'])
- rendered = unicode(form)
+ rendered = six.text_type(form)
self.assertTrue('something.txt' in rendered)
self.assertTrue('myfile-clear' in rendered)