From 9a2a52558e080f109a27d40a033a135c9d0e7e50 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 3 Sep 2016 19:00:00 +0300 Subject: Fixed #27171 -- Added unicode_literals and coding preamble to all files in startapp template on Python 2. --- tests/admin_scripts/tests.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/admin_scripts/tests.py') diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 1376ea9203..5ac24db6ea 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -613,7 +613,7 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase): self.addCleanup(shutil.rmtree, app_path) self.assertNoOutput(err) self.assertTrue(os.path.exists(app_path)) - unicode_literals_import = "from __future__ import unicode_literals\n" + unicode_literals_import = "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\n" with open(os.path.join(app_path, 'apps.py'), 'r') as f: content = f.read() self.assertIn("class SettingsTestConfig(AppConfig)", content) @@ -624,6 +624,15 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase): with open(os.path.join(app_path, 'models.py'), 'r') as fp: content = fp.read() self.assertIn(unicode_literals_import, content) + with open(os.path.join(app_path, 'views.py'), 'r') as fp: + content = fp.read() + self.assertIn(unicode_literals_import, content) + with open(os.path.join(app_path, 'admin.py'), 'r') as fp: + content = fp.read() + self.assertIn(unicode_literals_import, content) + with open(os.path.join(app_path, 'tests.py'), 'r') as fp: + content = fp.read() + self.assertIn(unicode_literals_import, content) def test_setup_environ_custom_template(self): "directory: startapp creates the correct directory with a custom template" -- cgit v1.3