Switched TestCase to SimpleTestCase where possible in Django's tests.

This commit is contained in:
Tim Graham 2018-11-26 14:05:02 -05:00
parent f091ea3515
commit 193c109327
37 changed files with 130 additions and 134 deletions

View file

@ -2,9 +2,9 @@ import json
from django.core import checks, exceptions, serializers
from django.forms import Form
from django.test.utils import isolate_apps, modify_settings
from django.test.utils import isolate_apps
from . import PostgreSQLTestCase
from . import PostgreSQLSimpleTestCase, PostgreSQLTestCase
from .models import HStoreModel, PostgreSQLModel
try:
@ -15,12 +15,7 @@ except ImportError:
pass
@modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'})
class HStoreTestCase(PostgreSQLTestCase):
pass
class SimpleTests(HStoreTestCase):
class SimpleTests(PostgreSQLTestCase):
def test_save_load_success(self):
value = {'a': 'b'}
instance = HStoreModel(field=value)
@ -69,7 +64,7 @@ class SimpleTests(HStoreTestCase):
self.assertEqual(instance.array_field, expected_value)
class TestQuerying(HStoreTestCase):
class TestQuerying(PostgreSQLTestCase):
def setUp(self):
self.objs = [
@ -191,7 +186,7 @@ class TestQuerying(HStoreTestCase):
@isolate_apps('postgres_tests')
class TestChecks(PostgreSQLTestCase):
class TestChecks(PostgreSQLSimpleTestCase):
def test_invalid_default(self):
class MyModel(PostgreSQLModel):
@ -218,7 +213,7 @@ class TestChecks(PostgreSQLTestCase):
self.assertEqual(MyModel().check(), [])
class TestSerialization(HStoreTestCase):
class TestSerialization(PostgreSQLSimpleTestCase):
test_data = json.dumps([{
'model': 'postgres_tests.hstoremodel',
'pk': None,
@ -248,7 +243,7 @@ class TestSerialization(HStoreTestCase):
self.assertEqual(instance.field, new_instance.field)
class TestValidation(HStoreTestCase):
class TestValidation(PostgreSQLSimpleTestCase):
def test_not_a_string(self):
field = HStoreField()
@ -262,7 +257,7 @@ class TestValidation(HStoreTestCase):
self.assertEqual(field.clean({'a': None}, None), {'a': None})
class TestFormField(HStoreTestCase):
class TestFormField(PostgreSQLSimpleTestCase):
def test_valid(self):
field = forms.HStoreField()
@ -325,7 +320,7 @@ class TestFormField(HStoreTestCase):
self.assertTrue(form_w_hstore.has_changed())
class TestValidator(HStoreTestCase):
class TestValidator(PostgreSQLSimpleTestCase):
def test_simple_valid(self):
validator = KeysValidator(keys=['a', 'b'])