From e021b87c0009c11aa2e62b62fc40b4b0209a8e5d Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Mon, 1 Jul 2013 22:49:07 +0200 Subject: [PATCH] Fixed a few more imports of django.utils.unittest. One import per line please! Refs #20680. --- django/contrib/gis/tests/geoapp/tests.py | 3 ++- tests/admin_views/tests.py | 4 +++- tests/backends/tests.py | 7 ++++--- tests/cache/tests.py | 7 +++++-- tests/utils_tests/test_dateformat.py | 4 +++- tests/utils_tests/test_feedgenerator.py | 5 ++++- tests/view_tests/tests/test_i18n.py | 3 ++- tests/wsgi/tests.py | 4 +++- 8 files changed, 26 insertions(+), 11 deletions(-) diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py index 89505ae1f2..487f879674 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -1,6 +1,7 @@ from __future__ import absolute_import import re +import unittest from unittest import skipUnless from django.db import connection @@ -10,7 +11,7 @@ from django.contrib.gis.tests.utils import ( no_mysql, no_oracle, no_spatialite, mysql, oracle, postgis, spatialite) from django.test import TestCase -from django.utils import six, unittest +from django.utils import six if HAS_GEOS: from django.contrib.gis.geos import (fromstr, GEOSGeometry, diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 1d63163771..101fcd90f6 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -4,6 +4,7 @@ from __future__ import absolute_import, unicode_literals import os import re import datetime +import unittest try: from urllib.parse import urljoin except ImportError: # Python 2 @@ -31,7 +32,8 @@ from django.forms.util import ErrorList from django.template.response import TemplateResponse from django.test import TestCase from django.test.utils import patch_logger -from django.utils import formats, translation, unittest +from django.utils import formats +from django.utils import translation from django.utils.cache import get_max_age from django.utils.encoding import iri_to_uri, force_bytes from django.utils.html import escape diff --git a/tests/backends/tests.py b/tests/backends/tests.py index 488f8d518b..b1bfa4cb21 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, unicode_literals import datetime from decimal import Decimal import threading +import unittest from django.conf import settings from django.core.management.color import no_style @@ -21,7 +22,7 @@ from django.db.utils import ConnectionHandler from django.test import (TestCase, skipUnlessDBFeature, skipIfDBFeature, TransactionTestCase) from django.test.utils import override_settings, str_prefix -from django.utils import six, unittest +from django.utils import six from django.utils.six.moves import xrange from . import models @@ -469,7 +470,7 @@ class BackendTestCase(TestCase): def create_squares_with_executemany(self, args): self.create_squares(args, 'format', True) - def create_squares(self, args, paramstyle, multiple): + def create_squares(self, args, paramstyle, multiple): cursor = connection.cursor() opts = models.Square._meta tbl = connection.introspection.table_name_converter(opts.db_table) @@ -541,7 +542,7 @@ class BackendTestCase(TestCase): # same test for DebugCursorWrapper self.create_squares(args, 'pyformat', multiple=True) self.assertEqual(models.Square.objects.count(), 9) - + def test_unicode_fetches(self): #6254: fetchone, fetchmany, fetchall return strings as unicode objects qn = connection.ops.quote_name diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 060f27e6e2..bccac6b5a8 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -6,13 +6,14 @@ from __future__ import absolute_import, unicode_literals import hashlib import os +import pickle import random import re import string import tempfile import time +import unittest import warnings -import pickle from django.conf import settings from django.core import management @@ -29,7 +30,9 @@ from django.template import Template from django.template.response import TemplateResponse from django.test import TestCase, TransactionTestCase, RequestFactory from django.test.utils import override_settings, IgnoreDeprecationWarningsMixin -from django.utils import six, timezone, translation, unittest +from django.utils import six +from django.utils import timezone +from django.utils import translation from django.utils.cache import (patch_vary_headers, get_cache_key, learn_cache_key, patch_cache_control, patch_response_headers) from django.utils.encoding import force_text diff --git a/tests/utils_tests/test_dateformat.py b/tests/utils_tests/test_dateformat.py index 78cedaf764..15262121a0 100644 --- a/tests/utils_tests/test_dateformat.py +++ b/tests/utils_tests/test_dateformat.py @@ -3,9 +3,11 @@ from __future__ import unicode_literals from datetime import datetime, date import os import time +import unittest from django.utils.dateformat import format -from django.utils import dateformat, translation, unittest +from django.utils import dateformat +from django.utils import translation from django.utils.timezone import utc from django.utils.tzinfo import FixedOffset, LocalTimezone diff --git a/tests/utils_tests/test_feedgenerator.py b/tests/utils_tests/test_feedgenerator.py index bcd53bb2a0..a801305f17 100644 --- a/tests/utils_tests/test_feedgenerator.py +++ b/tests/utils_tests/test_feedgenerator.py @@ -1,8 +1,11 @@ from __future__ import unicode_literals import datetime +import unittest + +from django.utils import feedgenerator +from django.utils import tzinfo -from django.utils import feedgenerator, tzinfo, unittest class FeedgeneratorTest(unittest.TestCase): """ diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py index b35b192fd0..c1852ee71f 100644 --- a/tests/view_tests/tests/test_i18n.py +++ b/tests/view_tests/tests/test_i18n.py @@ -4,12 +4,13 @@ from __future__ import absolute_import import gettext import os from os import path +import unittest from django.conf import settings from django.core.urlresolvers import reverse from django.test import LiveServerTestCase, TestCase from django.test.utils import override_settings -from django.utils import six, unittest +from django.utils import six from django.utils._os import upath from django.utils.translation import override from django.utils.text import javascript_quote diff --git a/tests/wsgi/tests.py b/tests/wsgi/tests.py index a66258d4eb..afd59a6e1f 100644 --- a/tests/wsgi/tests.py +++ b/tests/wsgi/tests.py @@ -1,5 +1,7 @@ from __future__ import unicode_literals +import unittest + from django.core.exceptions import ImproperlyConfigured from django.core.servers.basehttp import get_internal_wsgi_application from django.core.signals import request_started @@ -8,7 +10,7 @@ from django.db import close_old_connections from django.test import TestCase from django.test.client import RequestFactory from django.test.utils import override_settings -from django.utils import six, unittest +from django.utils import six class WSGITest(TestCase):