mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Allowed RemoveField operations to be optimized through.
This commit is contained in:
committed by
Tim Graham
parent
50b8c98a0f
commit
0025dd5eb4
@@ -2758,10 +2758,7 @@ class TestCreateModel(SimpleTestCase):
|
||||
|
||||
class FieldOperationTests(SimpleTestCase):
|
||||
def test_references_model(self):
|
||||
operation = FieldOperation('MoDel', 'field')
|
||||
# When missing a field declaration always assume it's referencing.
|
||||
self.assertIs(operation.references_model('Whatever'), True)
|
||||
operation.field = models.ForeignKey('Other', models.CASCADE)
|
||||
operation = FieldOperation('MoDel', 'field', models.ForeignKey('Other', models.CASCADE))
|
||||
# Model name match.
|
||||
self.assertIs(operation.references_model('mOdEl'), True)
|
||||
# Referenced field.
|
||||
@@ -2769,10 +2766,6 @@ class FieldOperationTests(SimpleTestCase):
|
||||
# Doesn't reference.
|
||||
self.assertIs(operation.references_model('Whatever'), False)
|
||||
|
||||
def test_references_field_missing_field(self):
|
||||
operation = FieldOperation('MoDel', 'field')
|
||||
self.assertIs(operation.references_field('Whatever', 'missing'), True)
|
||||
|
||||
def test_references_field_by_name(self):
|
||||
operation = FieldOperation('MoDel', 'field', models.BooleanField(default=False))
|
||||
self.assertIs(operation.references_field('model', 'field'), True)
|
||||
|
||||
Reference in New Issue
Block a user