summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorcoagulant <baryshev@gmail.com>2013-11-03 01:02:56 +0400
committerJason Myers <jason@jasonamyers.com>2013-11-02 23:50:33 -0500
commit8eec2d93b6e93b8a1107fb3de2acd68d6994d6ec (patch)
treedee448f4b73c925b10871f4fbe7d601f5feb576b /tests/forms_tests
parentc3791463a5a9674f8e0148fbab57eae23c138896 (diff)
Fixed all E261 warnings
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_forms.py2
-rw-r--r--tests/forms_tests/tests/test_formsets.py140
-rw-r--r--tests/forms_tests/tests/test_input_formats.py10
3 files changed, 76 insertions, 76 deletions
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")