summaryrefslogtreecommitdiff
path: root/tests/files
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2014-11-21 19:26:46 +0500
committerTim Graham <timograham@gmail.com>2014-11-24 15:54:57 -0500
commit1e9ac504e46cae277398ee21038a08fffaafd060 (patch)
tree824d3d4e9f401bf53571ac69374f864a9c325a01 /tests/files
parentebb927c4c997d4c8d9a55ec78cd2476a13bd1782 (diff)
downloaddjango-1e9ac504e46cae277398ee21038a08fffaafd060.tar.gz
Fixed #23888 -- Fixed crash in File.__repr__() when name contains unicode.
Diffstat (limited to 'tests/files')
-rw-r--r--tests/files/tests.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py
index f2f1df3626..e16ebd0729 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -26,13 +26,12 @@ else:
class FileTests(unittest.TestCase):
def test_unicode_uploadedfile_name(self):
- """
- Regression test for #8156: files with unicode names I can't quite figure
- out the encoding situation between doctest and this file, but the actual
- repr doesn't matter; it just shouldn't return a unicode object.
- """
uf = UploadedFile(name='¿Cómo?', content_type='text')
- self.assertEqual(type(uf.__repr__()), str)
+ self.assertIs(type(repr(uf)), str)
+
+ def test_unicode_file_name(self):
+ f = File(None, 'djángö')
+ self.assertIs(type(repr(f)), str)
def test_context_manager(self):
orig_file = tempfile.TemporaryFile()