def test_model_cls_could_not_be_rebound(self): """Test that field model class could not be rebound.""" class Model(models.DomainModel): """Test model.""" field = fields.Field() field.bind_model_cls(Model) with self.assertRaises(errors.Error): field.bind_model_cls(Model)
class ExampleModel(models.DomainModel): """Example model.""" field = fields.Field() field_default = fields.Field(default=123) field_default_callable = fields.Field(default=time.time) field_required_default = fields.Field(default=123, required=True) bool_field = fields.Bool() int_field = fields.Int() float_field = fields.Float() string_field = fields.String() binary_field = fields.Binary() date_field = fields.Date() datetime_field = fields.DateTime() model_field = fields.Model(RelatedModel) collection_field = fields.Collection(RelatedModel)
class RequiredFieldModel(models.DomainModel): """Example model for required fields.""" field_required = fields.Field(required=True)
class Model(models.DomainModel): """Test model.""" __view_key__ = fields.Field()
class Model(models.DomainModel): """Test model.""" __unique_key__ = fields.Field()
class Model(models.DomainModel): """Test model.""" field = fields.Field() __slots_optimization__ = False
class Model(models.DomainModel): """Test model.""" field = fields.Field()