mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.7.x] Fixed #23888 -- Fixed crash in File.__repr__() when name contains unicode.
Backport of 1e9ac504e4 from master
This commit is contained in:
committed by
Tim Graham
parent
014f699c8b
commit
78fe7ec14f
@@ -26,13 +26,12 @@ except ImproperlyConfigured:
|
||||
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user