def test_decimal_format(self): f = 123456 str_format='${0}' element = etree.Element('test') XmlDocument().to_parent(None, Decimal(str_format=str_format), f, element, ns_test) element = element[0] self.assertEquals(element.text, '$123456')
class InvoiceItem(TableModel): __tablename__ = 'cc_invoice_item' vat = Decimal(db_column='VAT') date = Date description = Unicode id = Integer64(primary_key=True) id_ext = Integer64 id_invoice = Integer64 price = Decimal type_ext = Unicode(1)
class ProductDescription(ComplexModel): __namespace__ = '' NameRus = String(max_len=255).customize(max_occurs=1, min_occurs=0) NameEng = String(max_len=255).customize(max_occurs=1, min_occurs=0) NameBotanic = String(max_len=255).customize(max_occurs=1, min_occurs=0) Code = Integer.customize(max_occurs=1, min_occurs=0) HS = String(max_len=512).customize(max_occurs=1, min_occurs=0) # we have to find datatype of HSCode HSCode = String(max_len=100).customize(max_occurs=1, min_occurs=0) OriginPlace = String(max_len=512).customize(max_occurs=1, min_occurs=0) OriginCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0) OriginCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0) Manufacturer = String(max_len=255).customize(max_occurs=1, min_occurs=0) ManufacturerCode = Integer.customize(max_occurs=1, min_occurs=0) Quantity = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantityUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityGross = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityGrossUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantityGrossUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) QuantitySpecial = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantitySpecialUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantitySpecialUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) Packages = Integer.customize(max_occurs=1, min_occurs=0) PackagesUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) # we have to find datatypes of PackagesType and PackagesTypeCode PackagesType = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesTypeCode = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesDescription = String(max_len=512).customize(max_occurs=1, min_occurs=0) Volume = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) VolumeUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) VolumeUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) Marking = String(max_len=100).customize(max_occurs=1, min_occurs=0) AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0)
class Logrefill(TableModel): __tablename__ = 'cc_logrefill' id = Integer64(primary_key=True) # card = ForeignKeyField(Card, db_column='card_id') card = Integer64(db_column='card_id') date = Date agent = Integer64(db_column='agent_id') credit = Decimal(default=0.0) description = Unicode # refill_type (amount:0, correction:1, extra fee:2,agent refund:3) refill_type = Integer32(default=0) added_invoice = Integer32(default=0)
class Logpayment(TableModel): __tablename__ = 'cc_logpayment' id = Integer64(primary_key=True) card = Integer64(db_column='card_id') date = Date(default_factory=date.today) description = Unicode payment = Decimal(default=0.0) # payment_type (amount:0, correction:1, extra fee:2,agent refund:3) payment_type = Integer32(default=0) id_logrefill = Integer64 added_commission = Integer32(default=0) added_refill = Integer32(default=0) agent = Integer64(db_column='agent_id')
def test_decimal(self): assert Decimal(10, 4).Attributes.total_digits == 10 assert Decimal(10, 4).Attributes.fraction_digits == 4
max_len=50)) Applicatie = Mandatory( Unicode.customize(__namespace__=STUF_XML_NS, type_name='Applicatie', min_len=3, max_len=50)) Berichtcode = Mandatory( Unicode.customize(__namespace__=STUF_XML_NS, type_name='Berichtcode')) Code = Mandatory( Unicode.customize(__namespace__=STUF_XML_NS, type_name='Code', max_len=10)) Datum = Decimal.customize(__namespace__=STUF_XML_NS, type_name='Datum', total_digits=8, fraction_digits=0) Entiteittype = Unicode.customize(__namespace__=STUF_XML_NS, type_name='Entiteittype', max_len=30) EntiteittypeBSL = Entiteittype.customize(__namespace__=STUF_XML_NS, type_name='EntiteittypeBSL', pattern='BSL') EntiteittypeEDC = Entiteittype.customize(__namespace__=STUF_XML_NS, type_name='EntiteittypeEDC', pattern='EDC') EntiteittypeZAK = Entiteittype.customize(__namespace__=STUF_XML_NS,
class productDescription(ComplexModel): __namespace__ = '' NameRus = String(max_len=255).customize(max_occurs=1, min_occurs=0) NameEng = String(max_len=255).customize(max_occurs=1, min_occurs=0) NameBotanic = String(max_len=255).customize(max_occurs=1, min_occurs=0) Code = Integer.customize(max_occurs=1, min_occurs=0) HS = String(max_len=512).customize(max_occurs=1, min_occurs=0) # we have to find datatype of HSCode HSCode = String(max_len=100).customize(max_occurs=1, min_occurs=0) OriginPlace = String(max_len=512).customize(max_occurs=1, min_occurs=0) OriginCountry = String(max_len=100).customize(max_occurs=1, min_occurs=0) OriginCountryCode = String(max_len=2).customize(max_occurs=1, min_occurs=0) Manufacturer = String(max_len=255).customize(max_occurs=1, min_occurs=0) ManufacturerCode = Integer.customize(max_occurs=1, min_occurs=0) Quantity = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantityUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityGross = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantityGrossUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantityGrossUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) QuantitySpecial = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) QuantitySpecialUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) QuantitySpecialUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) Packages = Integer.customize(max_occurs=1, min_occurs=0) PackagesUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) # we have to find datatypes of PackagesType and PackagesTypeCode PackagesType = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesTypeCode = String(max_len=100).customize(max_occurs=1, min_occurs=0) PackagesDescription = String(max_len=512).customize(max_occurs=1, min_occurs=0) Volume = Decimal(max_len=3).customize(max_occurs=1, min_occurs=0) VolumeUnit = String(max_len=100).customize(max_occurs=1, min_occurs=0) VolumeUnitCode = String(max_len=3).customize(max_occurs=1, min_occurs=0) Marking = String(max_len=100).customize(max_occurs=1, min_occurs=0) AdditionalInfo = String(max_len=2000).customize(max_occurs=1, min_occurs=0) @staticmethod def generate(): return { 'NameRus': 'hello', 'NameEng': 'hello', 'NameBotanic': 'hello', 'Code': 'hello', 'HS': 'hi', 'HSCode': 'hello', 'OriginPlace': 'Tashkent', 'OriginCountry': 'hello', 'OriginCountryCode': 'hello', 'Manufacturer': 'hi', 'ManufacturerCode': 0, 'Quantity': 'hello', 'QuantityUnit': 'hello', 'QuantityUnitCode': 90, 'QuantityGross': 'hello', 'PackagesUnit': 'hello', 'PackageUnitCode': 'hello', 'PackagesType': 'hi', 'PackagesTypeCode': 0, 'PackagesDescription': 'hi', 'Volume': 0, 'VolumeUnit': 'hi', 'VolumeUnitCode': 0, 'Marking': 'hi', 'AdditionalInfo': 'hi', }
def _test_decimal_step(self): elt = _test_type(Decimal(fraction_digits=4), D('0.1')).xpath('div/input')[0] assert elt.attrib['step'] == '0.0001'
class reason(ComplexModel): __namespace__ = SOAP_DATAROBOT feature = Unicode() strength = Decimal()