diff options
Diffstat (limited to 'tests/invalid_models_tests')
| -rw-r--r-- | tests/invalid_models_tests/test_relative_fields.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py index 7e6d7612fd..04dca8b35e 100644 --- a/tests/invalid_models_tests/test_relative_fields.py +++ b/tests/invalid_models_tests/test_relative_fields.py @@ -357,7 +357,10 @@ class RelativeFieldTests(IsolatedModelsTestCase): self.assertEqual(errors, expected) def test_symmetric_self_reference_with_intermediate_table_and_through_fields(self): - """Using through_fields in a m2m with an intermediate model shouldn't mask its incompatibility with symmetry.""" + """ + Using through_fields in a m2m with an intermediate model shouldn't + mask its incompatibility with symmetry. + """ class Person(models.Model): # Explicit symmetrical=True. friends = models.ManyToManyField('self', @@ -394,8 +397,8 @@ class RelativeFieldTests(IsolatedModelsTestCase): errors = field.check() expected = [ Error( - ("Field defines a relation with model 'AbstractModel', " - "which is either not installed, or is abstract."), + "Field defines a relation with model 'AbstractModel', " + "which is either not installed, or is abstract.", hint=None, obj=field, id='fields.E300', @@ -415,8 +418,8 @@ class RelativeFieldTests(IsolatedModelsTestCase): errors = field.check(from_model=Model) expected = [ Error( - ("Field defines a relation with model 'AbstractModel', " - "which is either not installed, or is abstract."), + "Field defines a relation with model 'AbstractModel', " + "which is either not installed, or is abstract.", hint=None, obj=field, id='fields.E300', @@ -500,8 +503,8 @@ class RelativeFieldTests(IsolatedModelsTestCase): errors = field.check() expected = [ Error( - ("None of the fields 'country_id', 'city_id' on model 'Person' " - "have a unique=True constraint."), + "None of the fields 'country_id', 'city_id' on model 'Person' " + "have a unique=True constraint.", hint=None, obj=field, id='fields.E310', @@ -1333,7 +1336,11 @@ class M2mThroughFieldsTests(IsolatedModelsTestCase): pass class Event(models.Model): - invitees = models.ManyToManyField(Fan, through='Invitation', through_fields=('invalid_field_1', 'invalid_field_2')) + invitees = models.ManyToManyField( + Fan, + through='Invitation', + through_fields=('invalid_field_1', 'invalid_field_2'), + ) class Invitation(models.Model): event = models.ForeignKey(Event, models.CASCADE) @@ -1344,12 +1351,12 @@ class M2mThroughFieldsTests(IsolatedModelsTestCase): errors = field.check(from_model=Event) expected = [ Error( - ("The intermediary model 'invalid_models_tests.Invitation' has no field 'invalid_field_1'."), + "The intermediary model 'invalid_models_tests.Invitation' has no field 'invalid_field_1'.", hint="Did you mean one of the following foreign keys to 'Event': event?", obj=field, id='fields.E338'), Error( - ("The intermediary model 'invalid_models_tests.Invitation' has no field 'invalid_field_2'."), + "The intermediary model 'invalid_models_tests.Invitation' has no field 'invalid_field_2'.", hint="Did you mean one of the following foreign keys to 'Fan': invitee, inviter?", obj=field, id='fields.E338'), @@ -1376,9 +1383,9 @@ class M2mThroughFieldsTests(IsolatedModelsTestCase): errors = field.check(from_model=Event) expected = [ Error( - ("Field specifies 'through_fields' but does not provide the names " - "of the two link fields that should be used for the relation " - "through model 'invalid_models_tests.Invitation'."), + "Field specifies 'through_fields' but does not provide the names " + "of the two link fields that should be used for the relation " + "through model 'invalid_models_tests.Invitation'.", hint=("Make sure you specify 'through_fields' as " "through_fields=('field1', 'field2')"), obj=field, |
