Python peewee 模块,FixedCharField() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用peewee.FixedCharField()

项目:peewee-db-evolve    作者:keredson    | 项目源码 | 文件源码
def test_change_fixed_column_max_length(self):
    class SomeModel(pw.Model):
      some_field = pw.FixedCharField(default='w', max_length=1)
      class Meta:
        database = self.db
    self.evolve_and_check_noop()
    peeweedbevolve.clear()
    class SomeModel(pw.Model):
      some_field = pw.FixedCharField(default='woot', max_length=4)
      class Meta:
        database = self.db
    self.evolve_and_check_noop()
    model = SomeModel.create()
    self.assertEqual(model.some_field, 'woot')
    self.assertEqual(SomeModel.select().first().some_field, 'woot')