1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #11964 -- Changed CheckConstraint() signature to use keyword-only arguments.

Also renamed the `constraint` argument to `check` to better represent which
part of the constraint the provided `Q` object represents.
This commit is contained in:
Simon Charette
2018-08-05 22:15:10 -04:00
committed by Tim Graham
parent 0bf7b25f8f
commit 9142bebff2
9 changed files with 34 additions and 34 deletions

View File

@@ -110,7 +110,7 @@ class OperationTestBase(MigrationTestBase):
if check_constraint:
operations.append(migrations.AddConstraint(
"Pony",
models.CheckConstraint(models.Q(pink__gt=2), name="pony_test_constraint")
models.CheckConstraint(check=models.Q(pink__gt=2), name="pony_test_constraint")
))
if second_model:
operations.append(migrations.CreateModel(
@@ -471,7 +471,7 @@ class OperationTests(OperationTestBase):
@skipUnlessDBFeature('supports_table_check_constraints')
def test_create_model_with_constraint(self):
where = models.Q(pink__gt=2)
check_constraint = models.CheckConstraint(where, name='test_constraint_pony_pink_gt_2')
check_constraint = models.CheckConstraint(check=where, name='test_constraint_pony_pink_gt_2')
operation = migrations.CreateModel(
"Pony",
[
@@ -1782,7 +1782,7 @@ class OperationTests(OperationTestBase):
project_state = self.set_up_test_model('test_addconstraint')
where = models.Q(pink__gt=2)
check_constraint = models.CheckConstraint(where, name='test_constraint_pony_pink_gt_2')
check_constraint = models.CheckConstraint(check=where, name='test_constraint_pony_pink_gt_2')
operation = migrations.AddConstraint('Pony', check_constraint)
self.assertEqual(operation.describe(), 'Create constraint test_constraint_pony_pink_gt_2 on model Pony')