mirror of
https://github.com/django/django.git
synced 2025-12-23 09:19:27 +00:00
fix tests
This commit is contained in:
parent
4d85586caf
commit
16ae1e8cc5
1 changed files with 8 additions and 16 deletions
|
|
@ -831,15 +831,11 @@ class TestOtherTypesExactQuerying(PostgreSQLTestCase):
|
|||
@isolate_apps("postgres_tests")
|
||||
class TestChecks(PostgreSQLSimpleTestCase):
|
||||
def test_field_checks(self):
|
||||
class MyModel(PostgreSQLModel):
|
||||
field = ArrayField(models.CharField(max_length=-1))
|
||||
msg = "'max_length' must be a positive integer."
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
|
||||
model = MyModel()
|
||||
errors = model.check()
|
||||
self.assertEqual(len(errors), 1)
|
||||
# The inner CharField has a non-positive max_length.
|
||||
self.assertEqual(errors[0].id, "postgres.E001")
|
||||
self.assertIn("max_length", errors[0].msg)
|
||||
class MyModel(PostgreSQLModel):
|
||||
field = ArrayField(models.CharField(max_length=-1))
|
||||
|
||||
def test_base_field_check_kwargs(self):
|
||||
passed_kwargs = None
|
||||
|
|
@ -911,15 +907,11 @@ class TestChecks(PostgreSQLSimpleTestCase):
|
|||
Nested ArrayFields are permitted.
|
||||
"""
|
||||
|
||||
class MyModel(PostgreSQLModel):
|
||||
field = ArrayField(ArrayField(models.CharField(max_length=-1)))
|
||||
msg = "'max_length' must be a positive integer."
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
|
||||
model = MyModel()
|
||||
errors = model.check()
|
||||
self.assertEqual(len(errors), 1)
|
||||
# The inner CharField has a non-positive max_length.
|
||||
self.assertEqual(errors[0].id, "postgres.E001")
|
||||
self.assertIn("max_length", errors[0].msg)
|
||||
class MyModel(PostgreSQLModel):
|
||||
field = ArrayField(ArrayField(models.CharField(max_length=-1)))
|
||||
|
||||
def test_choices_tuple_list(self):
|
||||
class MyModel(PostgreSQLModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue