1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #24652 -- Used SimpleTestCase where appropriate.

This commit is contained in:
Simon Charette
2015-04-17 17:38:20 -04:00
parent e2b77acedd
commit be67400b47
93 changed files with 362 additions and 340 deletions

View File

@@ -9,7 +9,7 @@ from django.forms import (
ModelMultipleChoiceField, MultipleChoiceField, RegexField,
SplitDateTimeField, TimeField, URLField, ValidationError, utils,
)
from django.test import TestCase
from django.test import SimpleTestCase, TestCase
from django.utils.encoding import python_2_unicode_compatible
from django.utils.safestring import mark_safe
@@ -23,7 +23,7 @@ class AssertFormErrorsMixin(object):
self.assertEqual(e.messages, expected)
class FormsErrorMessagesTestCase(TestCase, AssertFormErrorsMixin):
class FormsErrorMessagesTestCase(SimpleTestCase, AssertFormErrorsMixin):
def test_charfield(self):
e = {
'required': 'REQUIRED',

View File

@@ -20,7 +20,7 @@ from django.forms import (
from django.forms.utils import ErrorList
from django.http import QueryDict
from django.template import Context, Template
from django.test import TestCase
from django.test import SimpleTestCase
from django.test.utils import str_prefix
from django.utils import six
from django.utils.datastructures import MultiValueDict
@@ -41,7 +41,7 @@ class PersonNew(Form):
birthday = DateField()
class FormsTestCase(TestCase):
class FormsTestCase(SimpleTestCase):
# A Form is a collection of Fields. It knows how to validate a set of data and it
# knows how to render itself in a couple of default ways (e.g., an HTML table).
# You can pass it data in __init__(), as a dictionary.

View File

@@ -9,7 +9,7 @@ from django.forms import (
)
from django.forms.formsets import BaseFormSet, formset_factory
from django.forms.utils import ErrorList
from django.test import TestCase
from django.test import SimpleTestCase
from django.utils.encoding import force_text
@@ -57,7 +57,7 @@ class SplitDateTimeForm(Form):
SplitDateTimeFormSet = formset_factory(SplitDateTimeForm)
class FormsFormsetTestCase(TestCase):
class FormsFormsetTestCase(SimpleTestCase):
def make_choiceformset(self, formset_data=None, formset_class=ChoiceFormSet,
total_forms=None, initial_forms=0, max_num_forms=0, min_num_forms=0, **kwargs):
@@ -1117,7 +1117,7 @@ class Choice(Form):
ChoiceFormSet = formset_factory(Choice)
class FormsetAsFooTests(TestCase):
class FormsetAsFooTests(SimpleTestCase):
def test_as_table(self):
formset = ChoiceFormSet(data, auto_id=False, prefix='choices')
self.assertHTMLEqual(formset.as_table(), """<input type="hidden" name="choices-TOTAL_FORMS" value="1" /><input type="hidden" name="choices-INITIAL_FORMS" value="0" /><input type="hidden" name="choices-MIN_NUM_FORMS" value="0" /><input type="hidden" name="choices-MAX_NUM_FORMS" value="0" />
@@ -1145,7 +1145,7 @@ class ArticleForm(Form):
ArticleFormSet = formset_factory(ArticleForm)
class TestIsBoundBehavior(TestCase):
class TestIsBoundBehavior(SimpleTestCase):
def test_no_data_raises_validation_error(self):
with self.assertRaises(ValidationError):
ArticleFormSet({}).is_valid()
@@ -1200,7 +1200,7 @@ class TestIsBoundBehavior(TestCase):
self.assertHTMLEqual(empty_forms[0].as_p(), empty_forms[1].as_p())
class TestEmptyFormSet(TestCase):
class TestEmptyFormSet(SimpleTestCase):
def test_empty_formset_is_valid(self):
"""Test that an empty formset still calls clean()"""
EmptyFsetWontValidateFormset = formset_factory(FavoriteDrinkForm, extra=0, formset=EmptyFsetWontValidate)

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.forms import CharField, Form, Media, MultiWidget, TextInput
from django.template import Context, Template
from django.test import TestCase, override_settings
from django.test import SimpleTestCase, override_settings
from django.utils.encoding import force_text
@@ -9,7 +9,7 @@ from django.utils.encoding import force_text
STATIC_URL=None,
MEDIA_URL='http://media.example.com/media/',
)
class FormsMediaTestCase(TestCase):
class FormsMediaTestCase(SimpleTestCase):
"""Tests for the media handling on widgets and forms"""
def test_construction(self):
@@ -466,7 +466,7 @@ class FormsMediaTestCase(TestCase):
STATIC_URL='http://media.example.com/static/',
MEDIA_URL='http://media.example.com/media/',
)
class StaticFormsMediaTestCase(TestCase):
class StaticFormsMediaTestCase(SimpleTestCase):
"""Tests for the media handling on widgets and forms"""
def test_construction(self):

View File

@@ -5,14 +5,14 @@ import copy
from django.core.exceptions import ValidationError
from django.forms.utils import ErrorDict, ErrorList, flatatt
from django.test import TestCase
from django.test import SimpleTestCase
from django.utils import six
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy
class FormsUtilsTestCase(TestCase):
class FormsUtilsTestCase(SimpleTestCase):
# Tests for forms/utils.py module.
def test_flatatt(self):

View File

@@ -18,7 +18,7 @@ from django.forms import (
from django.forms.widgets import (
ChoiceFieldRenderer, ChoiceInput, RadioFieldRenderer,
)
from django.test import TestCase, override_settings
from django.test import SimpleTestCase, override_settings
from django.utils import six, translation
from django.utils.dates import MONTHS_AP
from django.utils.encoding import force_text, python_2_unicode_compatible
@@ -27,7 +27,7 @@ from django.utils.safestring import SafeData, mark_safe
from ..models import Article
class FormsWidgetTests(TestCase):
class FormsWidgetTests(SimpleTestCase):
# Each Widget class corresponds to an HTML form widget. A Widget knows how to
# render itself, given a field name and some data. Widgets don't perform
# validation.
@@ -1173,7 +1173,7 @@ class NullBooleanSelectLazyForm(Form):
@override_settings(USE_L10N=True)
class FormsI18NWidgetsTests(TestCase):
class FormsI18NWidgetsTests(SimpleTestCase):
def setUp(self):
super(FormsI18NWidgetsTests, self).setUp()
translation.activate('de-at')
@@ -1261,7 +1261,7 @@ class SelectAndTextWidget(MultiWidget):
choices = property(_get_choices, _set_choices)
class WidgetTests(TestCase):
class WidgetTests(SimpleTestCase):
def test_12048(self):
# See ticket #12048.
w1 = SelectAndTextWidget(choices=[1, 2, 3])
@@ -1303,7 +1303,7 @@ class FakeFieldFile(object):
return self.url
class ClearableFileInputTests(TestCase):
class ClearableFileInputTests(SimpleTestCase):
def test_clear_input_renders(self):
"""
A ClearableFileInput with is_required False and rendered with
@@ -1436,7 +1436,7 @@ class GetDate(Form):
mydate = DateField(widget=SelectDateWidget)
class SelectDateWidgetTests(TestCase):
class SelectDateWidgetTests(SimpleTestCase):
# The forms library comes with some extra, higher-level Field and Widget
def test_selectdate(self):

View File

@@ -9,7 +9,7 @@ from django.forms import (
CharField, FileField, Form, ModelChoiceField, ModelForm,
)
from django.forms.models import ModelFormMetaclass
from django.test import TestCase
from django.test import SimpleTestCase, TestCase
from django.utils import six
from ..models import (
@@ -222,7 +222,7 @@ class FormsModelTestCase(TestCase):
self.assertEqual(obj.def_date, datetime.date(1999, 3, 2))
class RelatedModelFormTests(TestCase):
class RelatedModelFormTests(SimpleTestCase):
def test_invalid_loading_order(self):
"""
Test for issue 10405