diff options
Diffstat (limited to 'tests')
38 files changed, 201 insertions, 201 deletions
diff --git a/tests/admin_changelist/admin.py b/tests/admin_changelist/admin.py index d0797581dc..42b8c959af 100644 --- a/tests/admin_changelist/admin.py +++ b/tests/admin_changelist/admin.py @@ -98,7 +98,7 @@ site.register(Parent, NoListDisplayLinksParentAdmin) class SwallowAdmin(admin.ModelAdmin): - actions = None # prevent ['action_checkbox'] + list(list_display) + actions = None # prevent ['action_checkbox'] + list(list_display) list_display = ('origin', 'load', 'speed') site.register(Swallow, SwallowAdmin) diff --git a/tests/admin_filters/models.py b/tests/admin_filters/models.py index e0b8bde2de..bd2e4e5e98 100644 --- a/tests/admin_filters/models.py +++ b/tests/admin_filters/models.py @@ -13,7 +13,7 @@ class Book(models.Model): contributors = models.ManyToManyField(User, verbose_name="Verbose Contributors", related_name='books_contributed', blank=True, null=True) is_best_seller = models.NullBooleanField(default=0) date_registered = models.DateField(null=True) - no = models.IntegerField(verbose_name='number', blank=True, null=True) # This field is intentionally 2 characters long. See #16080. + no = models.IntegerField(verbose_name='number', blank=True, null=True) # This field is intentionally 2 characters long. See #16080. def __str__(self): return self.title diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py index bdfacdc206..bbec124d4d 100644 --- a/tests/admin_filters/tests.py +++ b/tests/admin_filters/tests.py @@ -78,12 +78,12 @@ class DecadeListFilterWithQuerysetBasedLookups(DecadeListFilterWithTitleAndParam class DecadeListFilterParameterEndsWith__In(DecadeListFilter): title = 'publication decade' - parameter_name = 'decade__in' # Ends with '__in" + parameter_name = 'decade__in' # Ends with '__in" class DecadeListFilterParameterEndsWith__Isnull(DecadeListFilter): title = 'publication decade' - parameter_name = 'decade__isnull' # Ends with '__isnull" + parameter_name = 'decade__isnull' # Ends with '__isnull" class DepartmentListFilterLookupWithNonStringValue(SimpleListFilter): diff --git a/tests/admin_inlines/admin.py b/tests/admin_inlines/admin.py index 98c19befa4..da5ddc03b3 100644 --- a/tests/admin_inlines/admin.py +++ b/tests/admin_inlines/admin.py @@ -43,7 +43,7 @@ class AuthorAdmin(admin.ModelAdmin): class InnerInline(admin.StackedInline): model = Inner can_delete = False - readonly_fields = ('readonly',) # For bug #13174 tests. + readonly_fields = ('readonly',) # For bug #13174 tests. class HolderAdmin(admin.ModelAdmin): diff --git a/tests/admin_ordering/tests.py b/tests/admin_ordering/tests.py index 763e97bd72..0085b35586 100644 --- a/tests/admin_ordering/tests.py +++ b/tests/admin_ordering/tests.py @@ -51,7 +51,7 @@ class TestAdminOrdering(TestCase): it actually changes. """ class BandAdmin(ModelAdmin): - ordering = ('rank',) # default ordering is ('name',) + ordering = ('rank',) # default ordering is ('name',) ma = BandAdmin(Band, None) names = [b.name for b in ma.get_queryset(request)] self.assertEqual(['Radiohead', 'Van Halen', 'Aerosmith'], names) diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py index 36b35aeefe..2aa96fbafa 100644 --- a/tests/admin_views/admin.py +++ b/tests/admin_views/admin.py @@ -262,7 +262,7 @@ class Podcast(Media): release_date = models.DateField() class Meta: - ordering = ('release_date',) # overridden in PodcastAdmin + ordering = ('release_date',) # overridden in PodcastAdmin class PodcastAdmin(admin.ModelAdmin): @@ -444,7 +444,7 @@ class PostAdmin(admin.ModelAdmin): class CustomChangeList(ChangeList): def get_queryset(self, request): - return self.root_queryset.filter(pk=9999) # Does not exist + return self.root_queryset.filter(pk=9999) # Does not exist class GadgetAdmin(admin.ModelAdmin): @@ -527,7 +527,7 @@ class StoryForm(forms.ModelForm): class StoryAdmin(admin.ModelAdmin): list_display = ('id', 'title', 'content') - list_display_links = ('title',) # 'id' not in list_display_links + list_display_links = ('title',) # 'id' not in list_display_links list_editable = ('content', ) form = StoryForm ordering = ["-pk"] @@ -535,7 +535,7 @@ class StoryAdmin(admin.ModelAdmin): class OtherStoryAdmin(admin.ModelAdmin): list_display = ('id', 'title', 'content') - list_display_links = ('title', 'id') # 'id' in list_display_links + list_display_links = ('title', 'id') # 'id' in list_display_links list_editable = ('content', ) ordering = ["-pk"] diff --git a/tests/admin_views/customadmin.py b/tests/admin_views/customadmin.py index f964d6cffb..560b4409c2 100644 --- a/tests/admin_views/customadmin.py +++ b/tests/admin_views/customadmin.py @@ -17,7 +17,7 @@ class Admin2(admin.AdminSite): login_form = forms.CustomAdminAuthenticationForm login_template = 'custom_admin/login.html' logout_template = 'custom_admin/logout.html' - index_template = ['custom_admin/index.html'] # a list, to test fix for #18697 + index_template = ['custom_admin/index.html'] # a list, to test fix for #18697 password_change_template = 'custom_admin/password_change_form.html' password_change_done_template = 'custom_admin/password_change_done.html' @@ -42,7 +42,7 @@ class UserLimitedAdmin(UserAdmin): class CustomPwdTemplateUserAdmin(UserAdmin): - change_user_password_template = ['admin/auth/user/change_password.html'] # a list, to test fix for #18697 + change_user_password_template = ['admin/auth/user/change_password.html'] # a list, to test fix for #18697 site = Admin2(name="admin2") diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py index 67f3b4216a..4dcca9a4cb 100644 --- a/tests/admin_views/models.py +++ b/tests/admin_views/models.py @@ -256,7 +256,7 @@ class Podcast(Media): release_date = models.DateField() class Meta: - ordering = ('release_date',) # overridden in PodcastAdmin + ordering = ('release_date',) # overridden in PodcastAdmin class Vodcast(Media): diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 0aa8e98933..4b36f8bd32 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -911,7 +911,7 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCas self.assertSelectOptions(to_box, [str(self.peter.id), str(self.jason.id)]) - input.send_keys([Keys.BACK_SPACE]) # Clear text box + input.send_keys([Keys.BACK_SPACE]) # Clear text box self.assertSelectOptions(from_box, [str(self.arthur.id), str(self.bob.id), str(self.cliff.id), str(self.jenny.id), @@ -922,7 +922,7 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCas # Save and check that everything is properly stored in the database --- self.selenium.find_element_by_xpath('//input[@value="Save"]').click() self.wait_page_loaded() - self.school = models.School.objects.get(id=self.school.id) # Reload from database + self.school = models.School.objects.get(id=self.school.id) # Reload from database self.assertEqual(list(self.school.students.all()), [self.jason, self.peter]) self.assertEqual(list(self.school.alumni.all()), diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 8e192bd082..be42a13181 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -70,7 +70,7 @@ class AggregationTests(TestCase): Regression test for #11916: Extra params + aggregation creates incorrect SQL. """ - #oracle doesn't support subqueries in group by clause + # oracle doesn't support subqueries in group by clause shortest_book_sql = """ SELECT name FROM aggregation_regress_book b diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 0c6ae91553..a79d4d9fac 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -1486,7 +1486,7 @@ class CacheI18nTest(TestCase): request = self._get_request() response = HttpResponse() with timezone.override(CustomTzName()): - CustomTzName.name = 'Hora estándar de Argentina'.encode('UTF-8') # UTF-8 string + CustomTzName.name = 'Hora estándar de Argentina'.encode('UTF-8') # UTF-8 string sanitized_name = 'Hora_estndar_de_Argentina' self.assertIn(sanitized_name, learn_cache_key(request, response), "Cache keys should include the time zone name when time zones are active") @@ -1645,9 +1645,9 @@ class CacheMiddlewareTest(IgnoreDeprecationWarningsMixin, TestCase): # First, test with "defaults": as_view_decorator = CacheMiddleware(cache_alias=None, key_prefix=None) - self.assertEqual(as_view_decorator.cache_timeout, 300) # Timeout value for 'default' cache, i.e. 300 + self.assertEqual(as_view_decorator.cache_timeout, 300) # Timeout value for 'default' cache, i.e. 300 self.assertEqual(as_view_decorator.key_prefix, '') - self.assertEqual(as_view_decorator.cache_alias, 'default') # Value of DEFAULT_CACHE_ALIAS from django.core.cache + self.assertEqual(as_view_decorator.cache_alias, 'default') # Value of DEFAULT_CACHE_ALIAS from django.core.cache self.assertEqual(as_view_decorator.cache_anonymous_only, False) # Next, test with custom values: diff --git a/tests/comment_tests/tests/test_moderation_views.py b/tests/comment_tests/tests/test_moderation_views.py index 62007e43fb..b70b01ed16 100644 --- a/tests/comment_tests/tests/test_moderation_views.py +++ b/tests/comment_tests/tests/test_moderation_views.py @@ -304,12 +304,12 @@ class AdminActionsTests(CommentTestCase): makeModerator("normaluser") self.client.login(username="normaluser", password="normaluser") with translation.override('en'): - #Test approving + # Test approving self.performActionAndCheckMessage('approve_comments', one_comment, '1 comment was successfully approved') self.performActionAndCheckMessage('approve_comments', many_comments, '3 comments were successfully approved') - #Test flagging + # Test flagging self.performActionAndCheckMessage('flag_comments', one_comment, '1 comment was successfully flagged') self.performActionAndCheckMessage('flag_comments', many_comments, '3 comments were successfully flagged') - #Test removing + # Test removing self.performActionAndCheckMessage('remove_comments', one_comment, '1 comment was successfully removed') self.performActionAndCheckMessage('remove_comments', many_comments, '3 comments were successfully removed') diff --git a/tests/datatypes/tests.py b/tests/datatypes/tests.py index 41e8a2d5d3..3cd954d3ad 100644 --- a/tests/datatypes/tests.py +++ b/tests/datatypes/tests.py @@ -37,7 +37,7 @@ class DataTypesTestCase(TestCase): self.assertEqual(d2.consumed_at, datetime.datetime(2007, 4, 20, 16, 19, 59)) def test_time_field(self): - #Test for ticket #12059: TimeField wrongly handling datetime.datetime object. + # Test for ticket #12059: TimeField wrongly handling datetime.datetime object. d = Donut(name='Apple Fritter') d.baked_time = datetime.datetime(year=2007, month=4, day=20, hour=16, minute=19, second=59) d.save() diff --git a/tests/file_uploads/uploadhandler.py b/tests/file_uploads/uploadhandler.py index b30ef136e9..2d4e52e4d5 100644 --- a/tests/file_uploads/uploadhandler.py +++ b/tests/file_uploads/uploadhandler.py @@ -11,7 +11,7 @@ class QuotaUploadHandler(FileUploadHandler): (5MB) is uploaded. """ - QUOTA = 5 * 2**20 # 5 MB + QUOTA = 5 * 2**20 # 5 MB def __init__(self, request=None): super(QuotaUploadHandler, self).__init__(request) diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index aecf8f32d5..b30742106b 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -938,7 +938,7 @@ class FormsTestCase(TestCase): class UserRegistration(Form): username = CharField(max_length=10) # uses TextInput by default password = CharField(max_length=10, widget=PasswordInput) - realname = CharField(max_length=10, widget=TextInput) # redundantly define widget, just to test + realname = CharField(max_length=10, widget=TextInput) # redundantly define widget, just to test address = CharField() # no max_length defined here p = UserRegistration(auto_id=False) diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py index 784724bf41..cf721b5510 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -198,10 +198,10 @@ class FormsFormsetTestCase(TestCase): # number of forms to be completed. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': '', 'choices-0-votes': '', 'choices-1-choice': '', @@ -251,10 +251,10 @@ class FormsFormsetTestCase(TestCase): # We can just fill out one of the forms. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-1-choice': '', @@ -275,10 +275,10 @@ class FormsFormsetTestCase(TestCase): # value in the returned data is not checked) data = { - 'choices-TOTAL_FORMS': '2', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '2', # max number of forms - should be ignored + 'choices-TOTAL_FORMS': '2', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '2', # max number of forms - should be ignored 'choices-0-choice': 'Zero', 'choices-0-votes': '0', 'choices-1-choice': 'One', @@ -297,10 +297,10 @@ class FormsFormsetTestCase(TestCase): # value in the returned data is not checked) data = { - 'choices-TOTAL_FORMS': '2', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms - should be ignored + 'choices-TOTAL_FORMS': '2', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms - should be ignored 'choices-0-choice': 'Zero', 'choices-0-votes': '0', 'choices-1-choice': 'One', @@ -316,14 +316,14 @@ class FormsFormsetTestCase(TestCase): # And once again, if we try to partially complete a form, validation will fail. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-1-choice': 'The Decemberists', - 'choices-1-votes': '', # missing value + 'choices-1-votes': '', # missing value 'choices-2-choice': '', 'choices-2-votes': '', } @@ -388,10 +388,10 @@ class FormsFormsetTestCase(TestCase): # 'on'. Let's go ahead and delete Fergie. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '2', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '2', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-0-DELETE': '', @@ -416,10 +416,10 @@ class FormsFormsetTestCase(TestCase): field = IntegerField(min_value=100) data = { - 'check-TOTAL_FORMS': '3', # the number of forms rendered - 'check-INITIAL_FORMS': '2', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'check-MAX_NUM_FORMS': '0', # max number of forms + 'check-TOTAL_FORMS': '3', # the number of forms rendered + 'check-INITIAL_FORMS': '2', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'check-MAX_NUM_FORMS': '0', # max number of forms 'check-0-field': '200', 'check-0-DELETE': '', 'check-1-field': '50', @@ -447,7 +447,7 @@ class FormsFormsetTestCase(TestCase): can_delete=True) p = PeopleForm( - {'form-0-name': '', 'form-0-DELETE': 'on', # no name! + {'form-0-name': '', 'form-0-DELETE': 'on', # no name! 'form-TOTAL_FORMS': 1, 'form-INITIAL_FORMS': 1, 'form-MIN_NUM_FORMS': 0, 'form-MAX_NUM_FORMS': 1}) @@ -484,10 +484,10 @@ class FormsFormsetTestCase(TestCase): <li>Order: <input type="number" name="choices-2-ORDER" /></li>""") data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '2', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '2', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-0-ORDER': '1', @@ -517,10 +517,10 @@ class FormsFormsetTestCase(TestCase): # they will be sorted below everything else. data = { - 'choices-TOTAL_FORMS': '4', # the number of forms rendered - 'choices-INITIAL_FORMS': '3', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '4', # the number of forms rendered + 'choices-INITIAL_FORMS': '3', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-0-ORDER': '1', @@ -554,10 +554,10 @@ class FormsFormsetTestCase(TestCase): # Ordering should work with blank fieldsets. data = { - 'choices-TOTAL_FORMS': '3', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '3', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms } ChoiceFormSet = formset_factory(Choice, can_order=True) @@ -607,10 +607,10 @@ class FormsFormsetTestCase(TestCase): # Let's delete Fergie, and put The Decemberists ahead of Calexico. data = { - 'choices-TOTAL_FORMS': '4', # the number of forms rendered - 'choices-INITIAL_FORMS': '3', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '4', # the number of forms rendered + 'choices-INITIAL_FORMS': '3', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', 'choices-0-ORDER': '1', @@ -653,7 +653,7 @@ class FormsFormsetTestCase(TestCase): p = PeopleForm({ 'form-0-name': '', - 'form-0-DELETE': 'on', # no name! + 'form-0-DELETE': 'on', # no name! 'form-TOTAL_FORMS': 1, 'form-INITIAL_FORMS': 1, 'form-MIN_NUM_FORMS': 0, @@ -671,10 +671,10 @@ class FormsFormsetTestCase(TestCase): # We start out with a some duplicate data. data = { - 'drinks-TOTAL_FORMS': '2', # the number of forms rendered - 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data - 'drinks-MIN_NUM_FORMS': '0', # min number of forms - 'drinks-MAX_NUM_FORMS': '0', # max number of forms + 'drinks-TOTAL_FORMS': '2', # the number of forms rendered + 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data + 'drinks-MIN_NUM_FORMS': '0', # min number of forms + 'drinks-MAX_NUM_FORMS': '0', # max number of forms 'drinks-0-name': 'Gin and Tonic', 'drinks-1-name': 'Gin and Tonic', } @@ -691,10 +691,10 @@ class FormsFormsetTestCase(TestCase): # Make sure we didn't break the valid case. data = { - 'drinks-TOTAL_FORMS': '2', # the number of forms rendered - 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data - 'drinks-MIN_NUM_FORMS': '0', # min number of forms - 'drinks-MAX_NUM_FORMS': '0', # max number of forms + 'drinks-TOTAL_FORMS': '2', # the number of forms rendered + 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data + 'drinks-MIN_NUM_FORMS': '0', # min number of forms + 'drinks-MAX_NUM_FORMS': '0', # max number of forms 'drinks-0-name': 'Gin and Tonic', 'drinks-1-name': 'Bloody Mary', } @@ -859,10 +859,10 @@ class FormsFormsetTestCase(TestCase): # Regression test for #12878 ################################################# data = { - 'drinks-TOTAL_FORMS': '2', # the number of forms rendered - 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data - 'drinks-MIN_NUM_FORMS': '0', # min number of forms - 'drinks-MAX_NUM_FORMS': '0', # max number of forms + 'drinks-TOTAL_FORMS': '2', # the number of forms rendered + 'drinks-INITIAL_FORMS': '0', # the number of forms with initial data + 'drinks-MIN_NUM_FORMS': '0', # min number of forms + 'drinks-MAX_NUM_FORMS': '0', # max number of forms 'drinks-0-name': 'Gin and Tonic', 'drinks-1-name': 'Gin and Tonic', } @@ -951,7 +951,7 @@ class FormsFormsetTestCase(TestCase): data = { 'choices-TOTAL_FORMS': '1', # number of forms rendered 'choices-INITIAL_FORMS': '0', # number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MIN_NUM_FORMS': '0', # min number of forms 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', @@ -972,7 +972,7 @@ class FormsFormsetTestCase(TestCase): { 'choices-TOTAL_FORMS': '4', 'choices-INITIAL_FORMS': '0', - 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MIN_NUM_FORMS': '0', # min number of forms 'choices-MAX_NUM_FORMS': '4', 'choices-0-choice': 'Zero', 'choices-0-votes': '0', @@ -1004,7 +1004,7 @@ class FormsFormsetTestCase(TestCase): { 'choices-TOTAL_FORMS': '4', 'choices-INITIAL_FORMS': '0', - 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MIN_NUM_FORMS': '0', # min number of forms 'choices-MAX_NUM_FORMS': '4', 'choices-0-choice': 'Zero', 'choices-0-votes': '0', @@ -1070,9 +1070,9 @@ class FormsFormsetTestCase(TestCase): def test_formset_total_error_count_with_non_form_errors(self): data = { - 'choices-TOTAL_FORMS': '2', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MAX_NUM_FORMS': '2', # max number of forms - should be ignored + 'choices-TOTAL_FORMS': '2', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MAX_NUM_FORMS': '2', # max number of forms - should be ignored 'choices-0-choice': 'Zero', 'choices-0-votes': '0', 'choices-1-choice': 'One', @@ -1089,10 +1089,10 @@ class FormsFormsetTestCase(TestCase): data = { - 'choices-TOTAL_FORMS': '1', # the number of forms rendered - 'choices-INITIAL_FORMS': '0', # the number of forms with initial data - 'choices-MIN_NUM_FORMS': '0', # min number of forms - 'choices-MAX_NUM_FORMS': '0', # max number of forms + 'choices-TOTAL_FORMS': '1', # the number of forms rendered + 'choices-INITIAL_FORMS': '0', # the number of forms with initial data + 'choices-MIN_NUM_FORMS': '0', # min number of forms + 'choices-MAX_NUM_FORMS': '0', # max number of forms 'choices-0-choice': 'Calexico', 'choices-0-votes': '100', } @@ -1156,7 +1156,7 @@ class TestIsBoundBehavior(TestCase): 'form-0-title': 'Test', 'form-0-pub_date': '1904-06-16', 'form-1-title': 'Test', - 'form-1-pub_date': '', # <-- this date is missing but required + 'form-1-pub_date': '', # <-- this date is missing but required } formset = ArticleFormSet(data) self.assertFalse(formset.is_valid()) diff --git a/tests/forms_tests/tests/test_input_formats.py b/tests/forms_tests/tests/test_input_formats.py index 95308d4eeb..25b491a499 100644 --- a/tests/forms_tests/tests/test_input_formats.py +++ b/tests/forms_tests/tests/test_input_formats.py @@ -191,7 +191,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase): result = f.clean('13.30.05') self.assertEqual(result, time(13, 30, 5)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "01:30:05 PM") @@ -385,7 +385,7 @@ class LocalizedDateTests(SimpleTestCase): result = f.clean('12.21.2010') self.assertEqual(result, date(2010, 12, 21)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "21.12.2010") @@ -478,7 +478,7 @@ class CustomDateInputFormatsTests(SimpleTestCase): result = f.clean('12.21.2010') self.assertEqual(result, date(2010, 12, 21)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "21.12.2010") @@ -671,7 +671,7 @@ class LocalizedDateTimeTests(SimpleTestCase): result = f.clean('13.30.05 12.21.2010') self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "21.12.2010 13:30:05") @@ -764,7 +764,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase): result = f.clean('12.21.2010 13:30:05') self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5)) - # # Check that the parsed result does a round trip to the same format + # Check that the parsed result does a round trip to the same format text = f.widget._format_value(result) self.assertEqual(text, "01:30:05 PM 21/12/2010") diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py index 1cf2f492a4..23f17f7b22 100644 --- a/tests/generic_inline_admin/tests.py +++ b/tests/generic_inline_admin/tests.py @@ -72,7 +72,7 @@ class GenericAdminViewTest(TestCase): "generic_inline_admin-media-content_type-object_id-MAX_NUM_FORMS": "0", } response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/episode/add/', post_data) - self.assertEqual(response.status_code, 302) # redirect somewhere + self.assertEqual(response.status_code, 302) # redirect somewhere def testBasicEditPost(self): """ @@ -93,7 +93,7 @@ class GenericAdminViewTest(TestCase): } url = '/generic_inline_admin/admin/generic_inline_admin/episode/%d/' % self.episode_pk response = self.client.post(url, post_data) - self.assertEqual(response.status_code, 302) # redirect somewhere + self.assertEqual(response.status_code, 302) # redirect somewhere def testGenericInlineFormset(self): EpisodeMediaFormSet = generic_inlineformset_factory(Media, can_delete=False, exclude=['description', 'keywords'], extra=3) @@ -208,7 +208,7 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase): response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/contact/add/') self.assertEqual(response.status_code, 200) response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/contact/add/', post_data) - self.assertEqual(response.status_code, 302) # redirect somewhere + self.assertEqual(response.status_code, 302) # redirect somewhere class NoInlineDeletionTest(TestCase): urls = "generic_inline_admin.urls" diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index 1e099d2bb4..820aecf1f7 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -315,11 +315,11 @@ class HttpResponseTests(unittest.TestCase): self.assertEqual(r.get('test'), None) def test_non_string_content(self): - #Bug 16494: HttpResponse should behave consistently with non-strings + # Bug 16494: HttpResponse should behave consistently with non-strings r = HttpResponse(12345) self.assertEqual(r.content, b'12345') - #test content via property + # test content via property r = HttpResponse() r.content = 12345 self.assertEqual(r.content, b'12345') @@ -328,7 +328,7 @@ class HttpResponseTests(unittest.TestCase): r = HttpResponse(['abc', 'def', 'ghi']) self.assertEqual(r.content, b'abcdefghi') - #test iter content via property + # test iter content via property r = HttpResponse() r.content = ['idan', 'alex', 'jacob'] self.assertEqual(r.content, b'idanalexjacob') @@ -337,13 +337,13 @@ class HttpResponseTests(unittest.TestCase): r.content = [1, 2, 3] self.assertEqual(r.content, b'123') - #test odd inputs + # test odd inputs r = HttpResponse() r.content = ['1', '2', 3, '\u079e'] #'\xde\x9e' == unichr(1950).encode('utf-8') self.assertEqual(r.content, b'123\xde\x9e') - #with Content-Encoding header + # with Content-Encoding header r = HttpResponse() r['Content-Encoding'] = 'winning' r.content = [b'abc', b'def'] @@ -573,8 +573,8 @@ class CookieTests(unittest.TestCase): """ c = SimpleCookie() c['test'] = "An,awkward;value" - self.assertTrue(";" not in c.output().rstrip(';')) # IE compat - self.assertTrue("," not in c.output().rstrip(';')) # Safari compat + self.assertTrue(";" not in c.output().rstrip(';')) # IE compat + self.assertTrue("," not in c.output().rstrip(';')) # Safari compat def test_decode(self): """ diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index 04bc0a8632..18088e5e16 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -423,7 +423,7 @@ class LocationCommentsTests(ExtractorTests): # #21208 -- Leaky paths in comments on Windows e.g. #: path\to\file.html.py:123 bad_suffix = '.py' - bad_string = 'templates%stest.html%s' % (os.sep, bad_suffix) # + bad_string = 'templates%stest.html%s' % (os.sep, bad_suffix) self.assertFalse(bad_string in po_contents, '"%s" shouldn\'t be in final .po file.' % bad_string) diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index e8b3ac7b7d..b1f3de0ef9 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -735,7 +735,7 @@ class FormattingTests(TransRealMixin, TestCase): with self.settings(FORMAT_MODULE_PATH='i18n.other.locale'): with translation.override('de', deactivate=True): old = str("%r") % get_format_modules(reverse=True) - new = str("%r") % get_format_modules(reverse=True) # second try + new = str("%r") % get_format_modules(reverse=True) # second try self.assertEqual(new, old, 'Value returned by get_formats_modules() must be preserved between calls.') def test_localize_templatetag_and_filter(self): diff --git a/tests/invalid_models/invalid_models/models.py b/tests/invalid_models/invalid_models/models.py index 8e04a4d328..0c991dcf13 100644 --- a/tests/invalid_models/invalid_models/models.py +++ b/tests/invalid_models/invalid_models/models.py @@ -1,4 +1,4 @@ -#encoding=utf-8 +# encoding=utf-8 """ 26. Invalid models diff --git a/tests/m2m_and_m2o/tests.py b/tests/m2m_and_m2o/tests.py index ee5d77919f..35443e32e4 100644 --- a/tests/m2m_and_m2o/tests.py +++ b/tests/m2m_and_m2o/tests.py @@ -82,6 +82,6 @@ class RelatedObjectUnicodeTests(TestCase): """ m1 = UnicodeReferenceModel.objects.create() m2 = UnicodeReferenceModel.objects.create() - m2.others.add(m1) # used to cause an error (see ticket #6045) + m2.others.add(m1) # used to cause an error (see ticket #6045) m2.save() - list(m2.others.all()) # Force retrieval. + list(m2.others.all()) # Force retrieval. diff --git a/tests/max_lengths/tests.py b/tests/max_lengths/tests.py index feb3351cf7..5dd33fc80f 100644 --- a/tests/max_lengths/tests.py +++ b/tests/max_lengths/tests.py @@ -34,6 +34,6 @@ class MaxLengthORMTests(unittest.TestCase): for field in ("email", "vcard", "homepage", "avatar"): new_args = args.copy() - new_args[field] = "X" * 250 # a value longer than any of the default fields could hold. + new_args[field] = "X" * 250 # a value longer than any of the default fields could hold. p = PersonWithCustomMaxLengths.objects.create(**new_args) self.assertEqual(getattr(p, field), ("X" * 250)) diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 2da852d11e..ddc7a4ceef 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -318,7 +318,7 @@ class ModelFormBaseTest(TestCase): class Meta: model = Category - fields = [] # url will still appear, since it is explicit above + fields = [] # url will still appear, since it is explicit above self.assertIsInstance(ReplaceField.base_fields['url'], forms.fields.BooleanField) @@ -348,7 +348,7 @@ class ModelFormBaseTest(TestCase): class CategoryForm(forms.ModelForm): class Meta: model = Category - fields = ('url') # note the missing comma + fields = ('url') # note the missing comma def test_exclude_fields(self): class ExcludeFields(forms.ModelForm): @@ -374,7 +374,7 @@ class ModelFormBaseTest(TestCase): class CategoryForm(forms.ModelForm): class Meta: model = Category - exclude = ('url') # note the missing comma + exclude = ('url') # note the missing comma def test_confused_form(self): class ConfusedForm(forms.ModelForm): @@ -415,7 +415,7 @@ class ModelFormBaseTest(TestCase): ) def test_bad_form(self): - #First class with a Meta class wins... + # First class with a Meta class wins... class BadForm(ArticleForm, BaseCategoryForm): pass @@ -818,10 +818,10 @@ class ModelToDictTests(TestCase): with self.assertNumQueries(1): d = model_to_dict(art) - #Ensure all many-to-many categories appear in model_to_dict + # Ensure all many-to-many categories appear in model_to_dict for c in categories: self.assertIn(c.pk, d['categories']) - #Ensure many-to-many relation appears as a list + # Ensure many-to-many relation appears as a list self.assertIsInstance(d['categories'], list) class OldFormForXTests(TestCase): diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py index 4c57e0f549..ac9d68132e 100644 --- a/tests/model_formsets/tests.py +++ b/tests/model_formsets/tests.py @@ -54,8 +54,8 @@ class DeletionTests(TestCase): 'form-0-id': six.text_type(poet.id), 'form-0-name': 'test', 'form-1-id': '', - 'form-1-name': 'x' * 1000, # Too long - 'form-1-id': six.text_type(poet.id), # Violate unique constraint + 'form-1-name': 'x' * 1000, # Too long + 'form-1-id': six.text_type(poet.id), # Violate unique constraint 'form-1-name': 'test2', } formset = PoetFormSet(data, queryset=Poet.objects.all()) @@ -145,9 +145,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_form-2-name">Name:</label> <input id="id_form-2-name" type="text" name="form-2-name" maxlength="100" /><input type="hidden" name="form-2-id" id="id_form-2-id" /></p>') data = { - 'form-TOTAL_FORMS': '3', # the number of forms rendered - 'form-INITIAL_FORMS': '0', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '3', # the number of forms rendered + 'form-INITIAL_FORMS': '0', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-name': 'Charles Baudelaire', 'form-1-name': 'Arthur Rimbaud', 'form-2-name': '', @@ -183,9 +183,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_form-2-name">Name:</label> <input id="id_form-2-name" type="text" name="form-2-name" maxlength="100" /><input type="hidden" name="form-2-id" id="id_form-2-id" /></p>') data = { - 'form-TOTAL_FORMS': '3', # the number of forms rendered - 'form-INITIAL_FORMS': '2', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '3', # the number of forms rendered + 'form-INITIAL_FORMS': '2', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-id': str(author2.id), 'form-0-name': 'Arthur Rimbaud', 'form-1-id': str(author1.id), @@ -227,9 +227,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_form-3-DELETE">Delete:</label> <input type="checkbox" name="form-3-DELETE" id="id_form-3-DELETE" /><input type="hidden" name="form-3-id" id="id_form-3-id" /></p>') data = { - 'form-TOTAL_FORMS': '4', # the number of forms rendered - 'form-INITIAL_FORMS': '3', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '4', # the number of forms rendered + 'form-INITIAL_FORMS': '3', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-id': str(author2.id), 'form-0-name': 'Arthur Rimbaud', 'form-1-id': str(author1.id), @@ -253,9 +253,9 @@ class ModelFormsetTest(TestCase): # Let's edit a record to ensure save only returns that one record. data = { - 'form-TOTAL_FORMS': '4', # the number of forms rendered - 'form-INITIAL_FORMS': '3', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '4', # the number of forms rendered + 'form-INITIAL_FORMS': '3', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-id': str(author2.id), 'form-0-name': 'Walt Whitman', 'form-1-id': str(author1.id), @@ -291,9 +291,9 @@ class ModelFormsetTest(TestCase): AuthorMeetingFormSet = modelformset_factory(AuthorMeeting, fields="__all__", extra=1, can_delete=True) data = { - 'form-TOTAL_FORMS': '2', # the number of forms rendered - 'form-INITIAL_FORMS': '1', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '2', # the number of forms rendered + 'form-INITIAL_FORMS': '1', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-id': str(meeting.id), 'form-0-name': '2nd Tuesday of the Week Meeting', 'form-0-authors': [author2.id, author1.id, author3.id, author4.id], @@ -379,9 +379,9 @@ class ModelFormsetTest(TestCase): PoetFormSet = modelformset_factory(Poet, fields="__all__", form=PoetForm) data = { - 'form-TOTAL_FORMS': '3', # the number of forms rendered - 'form-INITIAL_FORMS': '0', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '3', # the number of forms rendered + 'form-INITIAL_FORMS': '0', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-name': 'Walt Whitman', 'form-1-name': 'Charles Baudelaire', 'form-2-name': '', @@ -445,9 +445,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_form-0-write_speed">Write speed:</label> <input type="number" name="form-0-write_speed" id="id_form-0-write_speed" /><input type="hidden" name="form-0-author_ptr" id="id_form-0-author_ptr" /></p>') data = { - 'form-TOTAL_FORMS': '1', # the number of forms rendered - 'form-INITIAL_FORMS': '0', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '1', # the number of forms rendered + 'form-INITIAL_FORMS': '0', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-author_ptr': '', 'form-0-name': 'Ernest Hemingway', 'form-0-write_speed': '10', @@ -471,9 +471,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_form-1-write_speed">Write speed:</label> <input type="number" name="form-1-write_speed" id="id_form-1-write_speed" /><input type="hidden" name="form-1-author_ptr" id="id_form-1-author_ptr" /></p>') data = { - 'form-TOTAL_FORMS': '2', # the number of forms rendered - 'form-INITIAL_FORMS': '1', # the number of forms with initial data - 'form-MAX_NUM_FORMS': '', # the max number of forms + 'form-TOTAL_FORMS': '2', # the number of forms rendered + 'form-INITIAL_FORMS': '1', # the number of forms with initial data + 'form-MAX_NUM_FORMS': '', # the max number of forms 'form-0-author_ptr': hemingway_id, 'form-0-name': 'Ernest Hemingway', 'form-0-write_speed': '10', @@ -503,9 +503,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_book_set-2-title">Title:</label> <input id="id_book_set-2-title" type="text" name="book_set-2-title" maxlength="100" /><input type="hidden" name="book_set-2-author" value="%d" id="id_book_set-2-author" /><input type="hidden" name="book_set-2-id" id="id_book_set-2-id" /></p>' % author.id) data = { - 'book_set-TOTAL_FORMS': '3', # the number of forms rendered - 'book_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '3', # the number of forms rendered + 'book_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-title': 'Les Fleurs du Mal', 'book_set-1-title': '', 'book_set-2-title': '', @@ -537,9 +537,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_book_set-2-title">Title:</label> <input id="id_book_set-2-title" type="text" name="book_set-2-title" maxlength="100" /><input type="hidden" name="book_set-2-author" value="%d" id="id_book_set-2-author" /><input type="hidden" name="book_set-2-id" id="id_book_set-2-id" /></p>' % author.id) data = { - 'book_set-TOTAL_FORMS': '3', # the number of forms rendered - 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '3', # the number of forms rendered + 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-id': str(book1.id), 'book_set-0-title': 'Les Fleurs du Mal', 'book_set-1-title': 'Les Paradis Artificiels', @@ -568,9 +568,9 @@ class ModelFormsetTest(TestCase): Author.objects.create(name='Charles Baudelaire') data = { - 'book_set-TOTAL_FORMS': '3', # the number of forms rendered - 'book_set-INITIAL_FORMS': '2', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '3', # the number of forms rendered + 'book_set-INITIAL_FORMS': '2', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-id': '1', 'book_set-0-title': 'Les Fleurs du Mal', 'book_set-1-id': '2', @@ -613,9 +613,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_bookwithcustompk_set-0-title">Title:</label> <input id="id_bookwithcustompk_set-0-title" type="text" name="bookwithcustompk_set-0-title" maxlength="100" /><input type="hidden" name="bookwithcustompk_set-0-author" value="1" id="id_bookwithcustompk_set-0-author" /></p>') data = { - 'bookwithcustompk_set-TOTAL_FORMS': '1', # the number of forms rendered - 'bookwithcustompk_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'bookwithcustompk_set-MAX_NUM_FORMS': '', # the max number of forms + 'bookwithcustompk_set-TOTAL_FORMS': '1', # the number of forms rendered + 'bookwithcustompk_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'bookwithcustompk_set-MAX_NUM_FORMS': '', # the max number of forms 'bookwithcustompk_set-0-my_pk': '77777', 'bookwithcustompk_set-0-title': 'Les Fleurs du Mal', } @@ -645,9 +645,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_alternatebook_set-0-notes">Notes:</label> <input id="id_alternatebook_set-0-notes" type="text" name="alternatebook_set-0-notes" maxlength="100" /><input type="hidden" name="alternatebook_set-0-author" value="1" id="id_alternatebook_set-0-author" /><input type="hidden" name="alternatebook_set-0-book_ptr" id="id_alternatebook_set-0-book_ptr" /></p>') data = { - 'alternatebook_set-TOTAL_FORMS': '1', # the number of forms rendered - 'alternatebook_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'alternatebook_set-MAX_NUM_FORMS': '', # the max number of forms + 'alternatebook_set-TOTAL_FORMS': '1', # the number of forms rendered + 'alternatebook_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'alternatebook_set-MAX_NUM_FORMS': '', # the max number of forms 'alternatebook_set-0-title': 'Flowers of Evil', 'alternatebook_set-0-notes': 'English translation of Les Fleurs du Mal' } @@ -670,9 +670,9 @@ class ModelFormsetTest(TestCase): author = Author.objects.create(pk=1, name='Charles Baudelaire') data = { - 'bookwithoptionalalteditor_set-TOTAL_FORMS': '2', # the number of forms rendered - 'bookwithoptionalalteditor_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'bookwithoptionalalteditor_set-MAX_NUM_FORMS': '', # the max number of forms + 'bookwithoptionalalteditor_set-TOTAL_FORMS': '2', # the number of forms rendered + 'bookwithoptionalalteditor_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'bookwithoptionalalteditor_set-MAX_NUM_FORMS': '', # the max number of forms 'bookwithoptionalalteditor_set-0-author': '1', 'bookwithoptionalalteditor_set-0-title': 'Les Fleurs du Mal', 'bookwithoptionalalteditor_set-1-author': '1', @@ -708,9 +708,9 @@ class ModelFormsetTest(TestCase): PoemFormSet = inlineformset_factory(Poet, Poem, form=PoemForm, fields="__all__") data = { - 'poem_set-TOTAL_FORMS': '3', # the number of forms rendered - 'poem_set-INITIAL_FORMS': '0', # the number of forms with initial data - 'poem_set-MAX_NUM_FORMS': '', # the max number of forms + 'poem_set-TOTAL_FORMS': '3', # the number of forms rendered + 'poem_set-INITIAL_FORMS': '0', # the number of forms with initial data + 'poem_set-MAX_NUM_FORMS': '', # the max number of forms 'poem_set-0-name': 'The Cloud in Trousers', 'poem_set-1-name': 'I', 'poem_set-2-name': '', @@ -743,9 +743,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_book_set-4-title">Title:</label> <input id="id_book_set-4-title" type="text" name="book_set-4-title" maxlength="100" /><input type="hidden" name="book_set-4-author" value="1" id="id_book_set-4-author" /><input type="hidden" name="book_set-4-id" id="id_book_set-4-id" /></p>') data = { - 'book_set-TOTAL_FORMS': '5', # the number of forms rendered - 'book_set-INITIAL_FORMS': '3', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '5', # the number of forms rendered + 'book_set-INITIAL_FORMS': '3', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-id': str(book1.id), 'book_set-0-title': 'Les Paradis Artificiels', 'book_set-1-id': str(book2.id), @@ -768,9 +768,9 @@ class ModelFormsetTest(TestCase): '<p><label for="id_book_set-2-title">Title:</label> <input id="id_book_set-2-title" type="text" name="book_set-2-title" maxlength="100" /><input type="hidden" name="book_set-2-author" value="1" id="id_book_set-2-author" /><input type="hidden" name="book_set-2-id" id="id_book_set-2-id" /></p>') data = { - 'book_set-TOTAL_FORMS': '3', # the number of forms rendered - 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data - 'book_set-MAX_NUM_FORMS': '', # the max number of forms + 'book_set-TOTAL_FORMS': '3', # the number of forms rendered + 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data + 'book_set-MAX_NUM_FORMS': '', # the max number of forms 'book_set-0-id': str(book3.id), 'book_set-0-title': 'Flowers of Evil', 'book_set-1-title': 'Revue des deux mondes', @@ -958,7 +958,7 @@ class ModelFormsetTest(TestCase): data = { 'form-TOTAL_FORMS': '2', 'form-INITIAL_FORMS': '0', - 'form-MAX_NUM_FORMS': '2', # should be ignored + 'form-MAX_NUM_FORMS': '2', # should be ignored 'form-0-price': '12.00', 'form-0-quantity': '1', 'form-1-price': '24.00', @@ -1064,7 +1064,7 @@ class ModelFormsetTest(TestCase): # default. This is required to ensure the value is tested for change correctly # when determine what extra forms have changed to save. - self.assertEqual(len(formset.forms), 1) # this formset only has one form + self.assertEqual(len(formset.forms), 1) # this formset only has one form form = formset.forms[0] now = form.fields['date_joined'].initial() result = form.as_p() diff --git a/tests/modeladmin/models.py b/tests/modeladmin/models.py index 4789e35a43..27f54821d6 100644 --- a/tests/modeladmin/models.py +++ b/tests/modeladmin/models.py @@ -35,7 +35,7 @@ class ValidationTestModel(models.Model): is_active = models.BooleanField(default=False) pub_date = models.DateTimeField() band = models.ForeignKey(Band) - no = models.IntegerField(verbose_name="Number", blank=True, null=True) # This field is intentionally 2 characters long. See #16080. + no = models.IntegerField(verbose_name="Number", blank=True, null=True) # This field is intentionally 2 characters long. See #16080. def decade_published_in(self): return self.pub_date.strftime('%Y')[:3] + "0's" diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py index 046b8fb14b..8596346c7e 100644 --- a/tests/multiple_database/tests.py +++ b/tests/multiple_database/tests.py @@ -1791,10 +1791,10 @@ class RouterAttributeErrorTestCase(TestCase): def test_attribute_error_read(self): "Check that the AttributeError from AttributeErrorRouter bubbles up" - router.routers = [] # Reset routers so we can save a Book instance + router.routers = [] # Reset routers so we can save a Book instance b = Book.objects.create(title="Pro Django", published=datetime.date(2008, 12, 16)) - router.routers = [AttributeErrorRouter()] # Install our router + router.routers = [AttributeErrorRouter()] # Install our router self.assertRaises(AttributeError, Book.objects.get, pk=b.pk) def test_attribute_error_save(self): @@ -1806,22 +1806,22 @@ class RouterAttributeErrorTestCase(TestCase): def test_attribute_error_delete(self): "Check that the AttributeError from AttributeErrorRouter bubbles up" - router.routers = [] # Reset routers so we can save our Book, Person instances + router.routers = [] # Reset routers so we can save our Book, Person instances b = Book.objects.create(title="Pro Django", published=datetime.date(2008, 12, 16)) p = Person.objects.create(name="Marty Alchin") b.authors = [p] b.editor = p - router.routers = [AttributeErrorRouter()] # Install our router + router.routers = [AttributeErrorRouter()] # Install our router self.assertRaises(AttributeError, b.delete) def test_attribute_error_m2m(self): "Check that the AttributeError from AttributeErrorRouter bubbles up" - router.routers = [] # Reset routers so we can save our Book, Person instances + router.routers = [] # Reset routers so we can save our Book, Person instances b = Book.objects.create(title="Pro Django", published=datetime.date(2008, 12, 16)) p = Person.objects.create(name="Marty Alchin") - router.routers = [AttributeErrorRouter()] # Install our router + router.routers = [AttributeErrorRouter()] # Install our router self.assertRaises(AttributeError, setattr, b, 'authors', [p]) class ModelMetaRouter(object): diff --git a/tests/null_fk/tests.py b/tests/null_fk/tests.py index 29e1fcb4bb..d5b68658ff 100644 --- a/tests/null_fk/tests.py +++ b/tests/null_fk/tests.py @@ -50,7 +50,7 @@ class NullFkTests(TestCase): item = Item.objects.create(title='Some Item') pv = PropertyValue.objects.create(label='Some Value') item.props.create(key='a', value=pv) - item.props.create(key='b') # value=NULL + item.props.create(key='b') # value=NULL q1 = Q(props__key='a', props__value=pv) q2 = Q(props__key='b', props__value__isnull=True) diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py index 7ce4348c1a..077ac6f59c 100644 --- a/tests/queryset_pickle/tests.py +++ b/tests/queryset_pickle/tests.py @@ -10,7 +10,7 @@ from .models import Group, Event, Happening, Container, M2MModel class PickleabilityTestCase(TestCase): def setUp(self): - Happening.objects.create() # make sure the defaults are working (#20158) + Happening.objects.create() # make sure the defaults are working (#20158) def assert_pickles(self, qs): self.assertEqual(list(pickle.loads(pickle.dumps(qs))), list(qs)) diff --git a/tests/requests/tests.py b/tests/requests/tests.py index 137b324588..c00f5bb5e0 100644 --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -524,7 +524,7 @@ class HostValidationTests(SimpleTestCase): '12.34.56.78:443', '[2001:19f0:feee::dead:beef:cafe]', '[2001:19f0:feee::dead:beef:cafe]:8080', - 'xn--4ca9at.com', # Punnycode for öäü.com + 'xn--4ca9at.com', # Punnycode for öäü.com 'anything.multitenant.com', 'multitenant.com', 'insensitive.com', @@ -594,7 +594,7 @@ class HostValidationTests(SimpleTestCase): '12.34.56.78:443', '[2001:19f0:feee::dead:beef:cafe]', '[2001:19f0:feee::dead:beef:cafe]:8080', - 'xn--4ca9at.com', # Punnycode for öäü.com + 'xn--4ca9at.com', # Punnycode for öäü.com ] for host in legit_hosts: @@ -636,11 +636,11 @@ class HostValidationTests(SimpleTestCase): msg_suggestion = msg_invalid_host + "You may need to add %r to ALLOWED_HOSTS." msg_suggestion2 = msg_invalid_host + "The domain name provided is not valid according to RFC 1034/1035" - for host in [ # Valid-looking hosts + for host in [ # Valid-looking hosts 'example.com', '12.34.56.78', '[2001:19f0:feee::dead:beef:cafe]', - 'xn--4ca9at.com', # Punnycode for öäü.com + 'xn--4ca9at.com', # Punnycode for öäü.com ]: request = HttpRequest() request.META = {'HTTP_HOST': host} @@ -650,7 +650,7 @@ class HostValidationTests(SimpleTestCase): request.get_host ) - for domain, port in [ # Valid-looking hosts with a port number + for domain, port in [ # Valid-looking hosts with a port number ('example.com', 80), ('12.34.56.78', 443), ('[2001:19f0:feee::dead:beef:cafe]', 8080), diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index c8f29f471e..d71dd8c406 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -308,7 +308,7 @@ The end."""), (im2m_obj, 470, M2MIntermediateData, None), - #testing post- and prereferences and extra fields + # testing post- and prereferences and extra fields (im_obj, 480, Intermediate, {'right': 300, 'left': 470}), (im_obj, 481, Intermediate, {'right': 300, 'left': 490}), (im_obj, 482, Intermediate, {'right': 500, 'left': 470}), diff --git a/tests/template_tests/filters.py b/tests/template_tests/filters.py index 0531fb09cf..ad85d0cb0b 100644 --- a/tests/template_tests/filters.py +++ b/tests/template_tests/filters.py @@ -357,7 +357,7 @@ def get_filter_tests(): 'date01': (r'{{ d|date:"m" }}', {'d': datetime(2008, 1, 1)}, '01'), 'date02': (r'{{ d|date }}', {'d': datetime(2008, 1, 1)}, 'Jan. 1, 2008'), - #Ticket 9520: Make sure |date doesn't blow up on non-dates + # Ticket 9520: Make sure |date doesn't blow up on non-dates 'date03': (r'{{ d|date:"m" }}', {'d': 'fail_string'}, ''), # ISO date formats 'date04': (r'{{ d|date:"o" }}', {'d': datetime(2008, 12, 29)}, '2009'), diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index 9ee845ec51..bad15e2834 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -853,7 +853,7 @@ class TemplateTests(TransRealMixin, TestCase): # Numbers as filter arguments should work 'filter-syntax19': ('{{ var|truncatewords:1 }}', {"var": "hello world"}, "hello ..."), - #filters should accept empty string constants + # filters should accept empty string constants 'filter-syntax20': ('{{ ""|default_if_none:"was none" }}', {}, ""), # Fail silently for non-callable attribute and dict lookups which diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py index 75801427d3..14191306c4 100644 --- a/tests/test_client/tests.py +++ b/tests/test_client/tests.py @@ -439,7 +439,7 @@ class ClientTest(TestCase): "Request a page that is known to throw an error" self.assertRaises(KeyError, self.client.get, "/test_client/broken_view/") - #Try the same assertion, a different way + # Try the same assertion, a different way try: self.client.get('/test_client/broken_view/') self.fail('Should raise an error') diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py index 83d6a0097e..04fa734ddc 100644 --- a/tests/test_client_regress/tests.py +++ b/tests/test_client_regress/tests.py @@ -122,14 +122,14 @@ class AssertContainsTests(TestCase): def test_unicode_contains(self): "Unicode characters can be found in template context" - #Regression test for #10183 + # Regression test for #10183 r = self.client.get('/test_client_regress/check_unicode/') self.assertContains(r, 'さかき') self.assertContains(r, b'\xe5\xb3\xa0'.decode('utf-8')) def test_unicode_not_contains(self): "Unicode characters can be searched for, and not found in template context" - #Regression test for #10183 + # Regression test for #10183 r = self.client.get('/test_client_regress/check_unicode/') self.assertNotContains(r, 'はたけ') self.assertNotContains(r, b'\xe3\x81\xaf\xe3\x81\x9f\xe3\x81\x91'.decode('utf-8')) @@ -1204,7 +1204,7 @@ class UnicodePayloadTests(TestCase): def test_unicode_payload_non_utf(self): "A non-ASCII unicode data as a non-UTF based encoding can be POSTed" - #Regression test for #10571 + # Regression test for #10571 json = '{"dog": "собака"}' response = self.client.post("/test_client_regress/parse_unicode_json/", json, content_type="application/json; charset=koi8-r") diff --git a/tests/view_tests/__init__.py b/tests/view_tests/__init__.py index b031e205e0..371ab40b40 100644 --- a/tests/view_tests/__init__.py +++ b/tests/view_tests/__init__.py @@ -7,5 +7,5 @@ class BrokenException(Exception): except_args = (b'Broken!', # plain exception with ASCII text '¡Broken!', # non-ASCII unicode data - '¡Broken!'.encode('utf-8'), # non-ASCII, utf-8 encoded bytestring + '¡Broken!'.encode('utf-8'), # non-ASCII, utf-8 encoded bytestring b'\xa1Broken!', ) # non-ASCII, latin1 bytestring diff --git a/tests/view_tests/tests/test_defaults.py b/tests/view_tests/tests/test_defaults.py index 13e56d604b..128fb7cb07 100644 --- a/tests/view_tests/tests/test_defaults.py +++ b/tests/view_tests/tests/test_defaults.py @@ -10,8 +10,8 @@ from ..models import UrlArticle class DefaultsTests(TestCase): """Test django views in django/views/defaults.py""" fixtures = ['testdata.json'] - non_existing_urls = ['/views/non_existing_url/', # this is in urls.py - '/views/other_non_existing_url/'] # this NOT in urls.py + non_existing_urls = ['/views/non_existing_url/', # this is in urls.py + '/views/other_non_existing_url/'] # this NOT in urls.py def test_page_not_found(self): "A 404 status is returned by the page_not_found view" |
