

def test_name(self):
    '\n        Tests the outputting of the correct name if assigned one.\n        '
    field = models.CharField(max_length=65)
    (name, path, args, kwargs) = field.deconstruct()
    self.assertIsNone(name)
    field.set_attributes_from_name('is_awesome_test')
    (name, path, args, kwargs) = field.deconstruct()
    self.assertEqual(name, 'is_awesome_test')
    self.assertIsInstance(name, six.text_type)
    field = models.ForeignKey('some_fake.ModelName', models.CASCADE)
    (name, path, args, kwargs) = field.deconstruct()
    self.assertIsNone(name)
    field.set_attributes_from_name('author')
    (name, path, args, kwargs) = field.deconstruct()
    self.assertEqual(name, 'author')

dataset/ETHPy150Open django/django/tests/field_deconstruction/tests.py FieldDeconstructionTests.test_name/original