'CreateModel, AlterFooTogether/AlterOrderWithRespectTo followed by an
add/alter/rename field should optimize to CreateModel and the Alter*'

def _test_create_alter_foo_field(self, alter):

    self.assertOptimizesTo([migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField())]), alter, migrations.AddField('Foo', 'c', models.IntegerField())], [migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField()), ('c', models.IntegerField())]), alter])
    self.assertDoesNotOptimize([migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField())]), alter, migrations.AlterField('Foo', 'b', models.CharField(max_length=255))])
    self.assertOptimizesTo([migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField()), ('c', models.IntegerField())]), alter, migrations.AlterField('Foo', 'c', models.CharField(max_length=255))], [migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField()), ('c', models.CharField(max_length=255))]), alter])
    self.assertDoesNotOptimize([migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField())]), alter, migrations.RenameField('Foo', 'b', 'c')])
    self.assertOptimizesTo([migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField())]), alter, migrations.RenameField('Foo', 'b', 'x'), migrations.RenameField('Foo', 'x', 'c')], [migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField())]), alter, migrations.RenameField('Foo', 'b', 'c')])
    self.assertOptimizesTo([migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField()), ('c', models.IntegerField())]), alter, migrations.RenameField('Foo', 'c', 'd')], [migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField()), ('d', models.IntegerField())]), alter])
    self.assertDoesNotOptimize([migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField())]), alter, migrations.RemoveField('Foo', 'b')])
    self.assertOptimizesTo([migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField()), ('c', models.IntegerField())]), alter, migrations.RemoveField('Foo', 'c')], [migrations.CreateModel('Foo', [('a', models.IntegerField()), ('b', models.IntegerField())]), alter])
