From 78fe7ec14ff14130a99edb30584b0ffc49c8ec8c Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Fri, 21 Nov 2014 19:26:46 +0500 Subject: [1.7.x] Fixed #23888 -- Fixed crash in File.__repr__() when name contains unicode. Backport of 1e9ac504e4 from master --- tests/files/tests.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/files/tests.py b/tests/files/tests.py index b9f8b5228a..629659a01d 100644 --- a/tests/files/tests.py +++ b/tests/files/tests.py @@ -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() -- cgit v1.3