summaryrefslogtreecommitdiff
path: root/tests/invalid_models_tests/test_relative_fields.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-10-13 06:08:27 -0700
committerTim Graham <timograham@gmail.com>2015-10-14 05:21:08 -0700
commitc7aff31397a7228f6ac2e33c10ebdf36c4b7a9b7 (patch)
treea034b8762c029ef9f9b42ceef248081664220673 /tests/invalid_models_tests/test_relative_fields.py
parent92c1ae1b0b9955a511c19e07921c10126b6faa54 (diff)
Refs #25535 -- Minor edits to ForeignObject check changes.
Diffstat (limited to 'tests/invalid_models_tests/test_relative_fields.py')
-rw-r--r--tests/invalid_models_tests/test_relative_fields.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py
index 545aa87548..3ba95fdbe4 100644
--- a/tests/invalid_models_tests/test_relative_fields.py
+++ b/tests/invalid_models_tests/test_relative_fields.py
@@ -508,9 +508,11 @@ class RelativeFieldTests(IsolatedModelsTestCase):
errors = field.check()
expected = [
Error(
- "No subset of the fields 'country_id', 'city_id' on model 'Person' is unique",
- hint="Add a unique=True on any of the fields 'country_id', 'city_id' of 'Person', "
- "or add them all or a subset to a unique_together constraint.",
+ "No subset of the fields 'country_id', 'city_id' on model 'Person' is unique.",
+ hint=(
+ "Add unique=True on any of those fields or add at least "
+ "a subset of them to a unique_together constraint."
+ ),
obj=field,
id='fields.E310',
)
@@ -1404,15 +1406,12 @@ class M2mThroughFieldsTests(IsolatedModelsTestCase):
c = models.PositiveIntegerField()
class Meta:
- unique_together = (
- ('a', 'b', 'c'),
- )
+ unique_together = (('a', 'b', 'c'),)
class Child(models.Model):
a = models.PositiveIntegerField()
b = models.PositiveIntegerField()
value = models.CharField(max_length=255)
-
parent = ForeignObject(
Parent,
on_delete=models.SET_NULL,
@@ -1425,9 +1424,11 @@ class M2mThroughFieldsTests(IsolatedModelsTestCase):
errors = field.check(from_model=Child)
expected = [
Error(
- "No subset of the fields 'a', 'b' on model 'Parent' is unique",
- hint="Add a unique=True on any of the fields 'a', 'b' of 'Parent', or add them "
- "all or a subset to a unique_together constraint.",
+ "No subset of the fields 'a', 'b' on model 'Parent' is unique.",
+ hint=(
+ "Add unique=True on any of those fields or add at least "
+ "a subset of them to a unique_together constraint."
+ ),
obj=field,
id='fields.E310',
),
@@ -1442,16 +1443,13 @@ class M2mThroughFieldsTests(IsolatedModelsTestCase):
d = models.PositiveIntegerField()
class Meta:
- unique_together = (
- ('a', 'b', 'c'),
- )
+ unique_together = (('a', 'b', 'c'),)
class Child(models.Model):
a = models.PositiveIntegerField()
b = models.PositiveIntegerField()
d = models.PositiveIntegerField()
value = models.CharField(max_length=255)
-
parent = ForeignObject(
Parent,
on_delete=models.SET_NULL,
@@ -1464,9 +1462,11 @@ class M2mThroughFieldsTests(IsolatedModelsTestCase):
errors = field.check(from_model=Child)
expected = [
Error(
- "No subset of the fields 'a', 'b', 'd' on model 'Parent' is unique",
- hint="Add a unique=True on any of the fields 'a', 'b', 'd' of 'Parent', or add "
- "them all or a subset to a unique_together constraint.",
+ "No subset of the fields 'a', 'b', 'd' on model 'Parent' is unique.",
+ hint=(
+ "Add unique=True on any of those fields or add at least "
+ "a subset of them to a unique_together constraint."
+ ),
obj=field,
id='fields.E310',
),