mirror of
https://github.com/django/django.git
synced 2025-01-20 15:19:20 +00:00
Refs #25745 -- Isolated some postgres array field check tests.
This commit is contained in:
parent
64240263f2
commit
d95b22bd56
@ -4,6 +4,7 @@ import unittest
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.apps.registry import Apps
|
||||||
from django.core import exceptions, serializers, validators
|
from django.core import exceptions, serializers, validators
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.db import IntegrityError, connection, models
|
from django.db import IntegrityError, connection, models
|
||||||
@ -328,18 +329,28 @@ class TestOtherTypesExactQuerying(PostgreSQLTestCase):
|
|||||||
class TestChecks(PostgreSQLTestCase):
|
class TestChecks(PostgreSQLTestCase):
|
||||||
|
|
||||||
def test_field_checks(self):
|
def test_field_checks(self):
|
||||||
|
test_apps = Apps(['postgres_tests'])
|
||||||
|
|
||||||
class MyModel(PostgreSQLModel):
|
class MyModel(PostgreSQLModel):
|
||||||
field = ArrayField(models.CharField())
|
field = ArrayField(models.CharField())
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
apps = test_apps
|
||||||
|
|
||||||
model = MyModel()
|
model = MyModel()
|
||||||
errors = model.check()
|
errors = model.check()
|
||||||
self.assertEqual(len(errors), 1)
|
self.assertEqual(len(errors), 1)
|
||||||
self.assertEqual(errors[0].id, 'postgres.E001')
|
self.assertEqual(errors[0].id, 'postgres.E001')
|
||||||
|
|
||||||
def test_invalid_base_fields(self):
|
def test_invalid_base_fields(self):
|
||||||
|
test_apps = Apps(['postgres_tests'])
|
||||||
|
|
||||||
class MyModel(PostgreSQLModel):
|
class MyModel(PostgreSQLModel):
|
||||||
field = ArrayField(models.ManyToManyField('postgres_tests.IntegerArrayModel'))
|
field = ArrayField(models.ManyToManyField('postgres_tests.IntegerArrayModel'))
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
apps = test_apps
|
||||||
|
|
||||||
model = MyModel()
|
model = MyModel()
|
||||||
errors = model.check()
|
errors = model.check()
|
||||||
self.assertEqual(len(errors), 1)
|
self.assertEqual(len(errors), 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user