1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #23888 -- Fixed crash in File.__repr__() when name contains unicode.

This commit is contained in:
Sergey Fedoseev
2014-11-21 19:26:46 +05:00
committed by Tim Graham
parent ebb927c4c9
commit 1e9ac504e4
3 changed files with 12 additions and 9 deletions

View File

@@ -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()