From 8e2029f8ddd744acb97e236cb0703d94b12d5ff8 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 22 Oct 2013 08:28:34 -0400 Subject: [PATCH] Removed import * in tests. Thanks to flake8 path/to/file.py | awk -F ' ' '{ print $5 }' | sort | uniq --- django/contrib/admin/util.py | 2 +- django/contrib/formtools/tests/tests.py | 4 +++- django/contrib/gis/db/backends/util.py | 2 +- django/contrib/gis/geos/tests/test_geos_mutation.py | 2 +- django/contrib/webdesign/tests.py | 2 +- django/db/backends/util.py | 2 +- django/forms/util.py | 2 +- tests/admin_inlines/admin.py | 10 +++++++++- tests/defaultfilters/tests.py | 12 +++++++++++- tests/forms_tests/tests/test_error_messages.py | 8 +++++++- tests/forms_tests/tests/test_extra.py | 7 ++++++- tests/forms_tests/tests/test_fields.py | 9 ++++++++- tests/forms_tests/tests/test_forms.py | 8 +++++++- tests/forms_tests/tests/test_regressions.py | 6 +++++- tests/forms_tests/tests/test_widgets.py | 8 +++++++- tests/validators/tests.py | 8 +++++++- 16 files changed, 76 insertions(+), 16 deletions(-) diff --git a/django/contrib/admin/util.py b/django/contrib/admin/util.py index 92757d8e7f..a6ef5745ae 100644 --- a/django/contrib/admin/util.py +++ b/django/contrib/admin/util.py @@ -4,4 +4,4 @@ warnings.warn( "The django.contrib.admin.util module has been renamed. " "Use django.contrib.admin.utils instead.", PendingDeprecationWarning) -from django.contrib.admin.utils import * +from django.contrib.admin.utils import * # NOQA diff --git a/django/contrib/formtools/tests/tests.py b/django/contrib/formtools/tests/tests.py index fff483ce38..f3e83db0c6 100644 --- a/django/contrib/formtools/tests/tests.py +++ b/django/contrib/formtools/tests/tests.py @@ -12,7 +12,9 @@ from django.test import TestCase from django.test.utils import override_settings from django.utils._os import upath -from django.contrib.formtools.tests.forms import * +from django.contrib.formtools.tests.forms import ( + HashTestBlankForm, HashTestForm, TestForm, +) success_string = "Done was called!" success_string_encoded = success_string.encode() diff --git a/django/contrib/gis/db/backends/util.py b/django/contrib/gis/db/backends/util.py index aa3e9926a1..fc8ee994c7 100644 --- a/django/contrib/gis/db/backends/util.py +++ b/django/contrib/gis/db/backends/util.py @@ -4,4 +4,4 @@ warnings.warn( "The django.contrib.gis.db.backends.util module has been renamed. " "Use django.contrib.gis.db.backends.utils instead.", PendingDeprecationWarning) -from django.contrib.gis.db.backends.utils import * +from django.contrib.gis.db.backends.utils import * # NOQA diff --git a/django/contrib/gis/geos/tests/test_geos_mutation.py b/django/contrib/gis/geos/tests/test_geos_mutation.py index ad8a247fb6..0be82f821b 100644 --- a/django/contrib/gis/geos/tests/test_geos_mutation.py +++ b/django/contrib/gis/geos/tests/test_geos_mutation.py @@ -8,7 +8,7 @@ from unittest import skipUnless from .. import HAS_GEOS if HAS_GEOS: - from .. import * + from .. import fromstr, LinearRing, LineString, MultiPoint, Point, Polygon from ..error import GEOSIndexError diff --git a/django/contrib/webdesign/tests.py b/django/contrib/webdesign/tests.py index 16ec501e44..e4d9635522 100644 --- a/django/contrib/webdesign/tests.py +++ b/django/contrib/webdesign/tests.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import unittest -from django.contrib.webdesign.lorem_ipsum import * +from django.contrib.webdesign.lorem_ipsum import paragraphs, words from django.template import loader, Context diff --git a/django/db/backends/util.py b/django/db/backends/util.py index e4f1495c32..957a0d5825 100644 --- a/django/db/backends/util.py +++ b/django/db/backends/util.py @@ -4,4 +4,4 @@ warnings.warn( "The django.db.backends.util module has been renamed. " "Use django.db.backends.utils instead.", PendingDeprecationWarning) -from django.db.backends.utils import * +from django.db.backends.utils import * # NOQA diff --git a/django/forms/util.py b/django/forms/util.py index b97b10dd3d..e3638a0c06 100644 --- a/django/forms/util.py +++ b/django/forms/util.py @@ -4,4 +4,4 @@ warnings.warn( "The django.forms.util module has been renamed. " "Use django.forms.utils instead.", PendingDeprecationWarning) -from django.forms.utils import * +from django.forms.utils import * # NOQA diff --git a/tests/admin_inlines/admin.py b/tests/admin_inlines/admin.py index c141abe54e..91578042cc 100644 --- a/tests/admin_inlines/admin.py +++ b/tests/admin_inlines/admin.py @@ -1,7 +1,15 @@ from django.contrib import admin from django import forms -from .models import * +from .models import ( + Author, BinaryTree, CapoFamiglia, Chapter, ChildModel1, ChildModel2, + Consigliere, EditablePKBook, ExtraTerrestrial, Fashionista, Holder, + Holder2, Holder3, Holder4, Inner, Inner2, Inner3, Inner4Stacked, + Inner4Tabular, NonAutoPKBook, Novel, ParentModelWithCustomPk, Poll, + Profile, ProfileCollection, Question, ReadOnlyInline, ShoppingWeakness, + Sighting, SomeChildModel, SomeParentModel, SottoCapo, Title, + TitleCollection, +) site = admin.AdminSite(name="admin") diff --git a/tests/defaultfilters/tests.py b/tests/defaultfilters/tests.py index dd4c696beb..763628fe0e 100644 --- a/tests/defaultfilters/tests.py +++ b/tests/defaultfilters/tests.py @@ -5,7 +5,17 @@ import datetime import decimal import unittest -from django.template.defaultfilters import * +from django.template.defaultfilters import ( + add, addslashes, capfirst, center, cut, date, default, default_if_none, + dictsort, dictsortreversed, divisibleby, escape, escapejs_filter, + filesizeformat, first, fix_ampersands_filter, floatformat, force_escape, + get_digit, iriencode, join, length, length_is, linebreaksbr, + linebreaks_filter, linenumbers, ljust, lower, make_list, + phone2numeric_filter, pluralize, removetags, rjust, slice_filter, slugify, + stringformat, striptags, time, timesince_filter, timeuntil_filter, title, + truncatewords, truncatewords_html, unordered_list, upper, urlencode, + urlize, urlizetrunc, wordcount, wordwrap, yesno, +) from django.test import TestCase from django.utils import six from django.utils import translation diff --git a/tests/forms_tests/tests/test_error_messages.py b/tests/forms_tests/tests/test_error_messages.py index 5863b457f4..2d532c7cf9 100644 --- a/tests/forms_tests/tests/test_error_messages.py +++ b/tests/forms_tests/tests/test_error_messages.py @@ -4,7 +4,13 @@ from __future__ import unicode_literals import warnings from django.core.files.uploadedfile import SimpleUploadedFile -from django.forms import * +from django.forms import ( + BooleanField, CharField, ChoiceField, DateField, DateTimeField, + DecimalField, EmailField, FileField, FloatField, Form, + GenericIPAddressField, IntegerField, IPAddressField, ModelChoiceField, + ModelMultipleChoiceField, MultipleChoiceField, RegexField, + SplitDateTimeField, TimeField, URLField, utils, ValidationError, +) from django.test import TestCase from django.utils.safestring import mark_safe from django.utils.encoding import python_2_unicode_compatible diff --git a/tests/forms_tests/tests/test_extra.py b/tests/forms_tests/tests/test_extra.py index f32c764a1e..8833903d33 100644 --- a/tests/forms_tests/tests/test_extra.py +++ b/tests/forms_tests/tests/test_extra.py @@ -4,7 +4,12 @@ from __future__ import unicode_literals import datetime import warnings -from django.forms import * +from django.forms import ( + CharField, DateField, EmailField, FileField, Form, GenericIPAddressField, + HiddenInput, ImageField, IPAddressField, MultipleChoiceField, + MultiValueField, MultiWidget, PasswordInput, SelectMultiple, SlugField, + SplitDateTimeField, SplitDateTimeWidget, TextInput, URLField, +) from django.forms.extras import SelectDateWidget from django.forms.utils import ErrorList from django.test import TestCase diff --git a/tests/forms_tests/tests/test_fields.py b/tests/forms_tests/tests/test_fields.py index 4c787b1f2f..1ed07a0d88 100644 --- a/tests/forms_tests/tests/test_fields.py +++ b/tests/forms_tests/tests/test_fields.py @@ -33,7 +33,14 @@ import os from decimal import Decimal from django.core.files.uploadedfile import SimpleUploadedFile -from django.forms import * +from django.forms import ( + BooleanField, CharField, ChoiceField, ComboField, DateField, DateTimeField, + DecimalField, EmailField, Field, FileField, FilePathField, FloatField, + Form, forms, HiddenInput, IntegerField, MultipleChoiceField, + NullBooleanField, NumberInput, PasswordInput, RadioSelect, RegexField, + SplitDateTimeField, TextInput, TimeField, TypedChoiceField, + TypedMultipleChoiceField, URLField, ValidationError, Widget, +) from django.test import SimpleTestCase from django.utils import formats from django.utils import six diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 5dcde4e017..4feb47dfce 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -7,7 +7,13 @@ import warnings from django.core.files.uploadedfile import SimpleUploadedFile from django.core.validators import RegexValidator -from django.forms import * +from django.forms import ( + BooleanField, CharField, CheckboxSelectMultiple, ChoiceField, DateField, + EmailField, FileField, FloatField, Form, forms, HiddenInput, IntegerField, + MultipleChoiceField, MultipleHiddenInput, MultiValueField, + NullBooleanField, PasswordInput, RadioSelect, Select, SplitDateTimeField, + Textarea, TextInput, ValidationError, widgets, +) from django.http import QueryDict from django.template import Template, Context from django.test import TestCase diff --git a/tests/forms_tests/tests/test_regressions.py b/tests/forms_tests/tests/test_regressions.py index d230d68f75..e41e929fab 100644 --- a/tests/forms_tests/tests/test_regressions.py +++ b/tests/forms_tests/tests/test_regressions.py @@ -3,7 +3,11 @@ from __future__ import unicode_literals import warnings -from django.forms import * +from django.forms import ( + CharField, ChoiceField, Form, HiddenInput, IntegerField, ModelForm, + ModelMultipleChoiceField, MultipleChoiceField, RadioSelect, Select, + TextInput, +) from django.test import TestCase from django.utils.translation import ugettext_lazy, override diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py index 22c2d4258b..e6509e8699 100644 --- a/tests/forms_tests/tests/test_widgets.py +++ b/tests/forms_tests/tests/test_widgets.py @@ -7,7 +7,13 @@ import datetime from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse -from django.forms import * +from django.forms import ( + BooleanField, CheckboxInput, CheckboxSelectMultiple, ChoiceField, + ClearableFileInput, DateInput, DateTimeField, DateTimeInput, FileInput, + Form, HiddenInput, MultipleHiddenInput, MultiWidget, NullBooleanSelect, + PasswordInput, RadioSelect, Select, SelectMultiple, SplitDateTimeWidget, + Textarea, TextInput, TimeInput, +) from django.forms.widgets import RadioFieldRenderer from django.utils import formats from django.utils.safestring import mark_safe diff --git a/tests/validators/tests.py b/tests/validators/tests.py index 121d59803c..410fc15f0b 100644 --- a/tests/validators/tests.py +++ b/tests/validators/tests.py @@ -7,7 +7,13 @@ import types from unittest import TestCase from django.core.exceptions import ValidationError -from django.core.validators import * +from django.core.validators import ( + BaseValidator, EmailValidator, MaxLengthValidator, MaxValueValidator, + MinLengthValidator, MinValueValidator, RegexValidator, URLValidator, + validate_comma_separated_integer_list, validate_email, validate_integer, + validate_ipv46_address, validate_ipv4_address, validate_ipv6_address, + validate_slug, +) from django.test.utils import str_prefix