class ProductSignal(MongoModel): name = CharField() signalType = CharField() terminals = ListField() wires = IntegerField() min_value = FloatField() max_value = FloatField() class Meta: write_concern = WriteConcern(j=True) connection_alias = 'my-app'
class IfcShapeRepresentation(EmbeddedMongoModel): pid = IntegerField() identifier = CharField() RepresentationType = CharField() footprint = ListField(ListField()) footprint_react = DictField() top = FloatField() bottom = FloatField() center = ListField() class Meta: write_concern = WriteConcern(j=True) connection_alias = 'my-app'
class ProductPower(MongoModel): powerType = CharField() value = FloatField() class Meta: write_concern = WriteConcern(j=True) connection_alias = 'my-app'
class IfcStorey(MongoModel): pid = IntegerField() guid = CharField() ptype = CharField() name = CharField(blank=True) description = CharField(blank=True) longName = CharField(blank=True) building = ListField(ReferenceField(IfcBuilding)) pset = ListField(ReferenceField(IfcSingleProperty)) shape = EmbeddedDocumentField(IfcShapeRepresentation) version = ListField(ReferenceField(Version)) bottom = FloatField(blank=True) top = FloatField(blank=True) class Meta: write_concern = WriteConcern(j=True) connection_alias = 'my-app'
class Project(MongoModel): name = CharField() area = FloatField() buildingType = CharField() class Meta: write_concern = WriteConcern(j=True) connection_alias = 'my-app'
class FloatFieldTestCase(FieldTestCase): field = FloatField(min_value=0, max_value=100) def test_conversion(self): self.assertConversion(self.field, 42.0, '42') self.assertConversion(self.field, 42.0, 42) def test_validate(self): with self.assertRaisesRegex(ValidationError, 'greater than maximum'): self.field.validate(101) with self.assertRaisesRegex(ValidationError, 'less than minimum'): self.field.validate(-1) # No Exception. self.field.validate(42.123)
class IfcProject(MongoModel): pid = IntegerField() guid = CharField() ptype = CharField() name = CharField(blank=True) longName = CharField(blank=True) description = CharField(blank=True) phase = CharField(blank=True) lengthUnit = CharField(blank=True) lengthPrefix = CharField(blank=True) dir = ListField(FloatField(blank=True)) pset = ListField(ReferenceField(IfcSingleProperty)) version = ListField(ReferenceField(Version)) class Meta: write_concern = WriteConcern(j=True) connection_alias = 'my-app'
class IfcSite(MongoModel): pid = IntegerField() guid = CharField() ptype = CharField() name = CharField(blank=True) description = CharField(blank=True) refLatitude = ListField(blank=True) refLongitude = ListField(blank=True) refElevation = FloatField(blank=True) LandTitleNumber = CharField(blank=True) #quitself.SiteAddress = element.SiteAddress pset = ListField(ReferenceField(IfcSingleProperty)) project = ReferenceField(IfcProject) version = ListField(ReferenceField(Version)) class Meta: write_concern = WriteConcern(j=True) connection_alias = 'my-app'