mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed E128 flake8 warnings in tests/.
This commit is contained in:
@@ -817,23 +817,26 @@ class ModelStateTests(SimpleTestCase):
|
||||
def test_bound_field_sanity_check(self):
|
||||
field = models.CharField(max_length=1)
|
||||
field.model = models.Model
|
||||
with self.assertRaisesMessage(ValueError,
|
||||
'ModelState.fields cannot be bound to a model - "field" is.'):
|
||||
with self.assertRaisesMessage(ValueError, 'ModelState.fields cannot be bound to a model - "field" is.'):
|
||||
ModelState('app', 'Model', [('field', field)])
|
||||
|
||||
def test_sanity_check_to(self):
|
||||
field = models.ForeignKey(UnicodeModel, models.CASCADE)
|
||||
with self.assertRaisesMessage(ValueError,
|
||||
'ModelState.fields cannot refer to a model class - "field.to" does. '
|
||||
'Use a string reference instead.'):
|
||||
with self.assertRaisesMessage(
|
||||
ValueError,
|
||||
'ModelState.fields cannot refer to a model class - "field.to" does. '
|
||||
'Use a string reference instead.'
|
||||
):
|
||||
ModelState('app', 'Model', [('field', field)])
|
||||
|
||||
def test_sanity_check_through(self):
|
||||
field = models.ManyToManyField('UnicodeModel')
|
||||
field.remote_field.through = UnicodeModel
|
||||
with self.assertRaisesMessage(ValueError,
|
||||
'ModelState.fields cannot refer to a model class - "field.through" does. '
|
||||
'Use a string reference instead.'):
|
||||
with self.assertRaisesMessage(
|
||||
ValueError,
|
||||
'ModelState.fields cannot refer to a model class - "field.through" does. '
|
||||
'Use a string reference instead.'
|
||||
):
|
||||
ModelState('app', 'Model', [('field', field)])
|
||||
|
||||
def test_fields_immutability(self):
|
||||
|
||||
Reference in New Issue
Block a user