class Test(xsd.ComplexType): value = xsd.Element(xsd.Integer(totalDigits=2))
@classmethod def create(cls, action, id): instance = cls() instance.action = action instance.id = id return instance Schema = xsd.Schema(targetNamespace='http://flightdataservices.com/ops.xsd', elementFormDefault='unqualified', simpleTypes=[Pilot], attributeGroups=[], groups=[], complexTypes=[Airport, Weight, Ops, Status], elements={ 'ops': xsd.Element('Ops'), 'status': xsd.Element('Status') }) PutOps_method = xsd.Method( soapAction='http://polaris.flightdataservices.com/ws/ops/PutOps', input='ops', # Pointer to Schema.elements inputPartName='body', output='status', # Pointer to Schema.elements outputPartName='body', operationName='PutOps') PutOpsPort_SERVICE = soap.Service( name='PutOpsPort', targetNamespace='http://flightdataservices.com/ops.wsdl', location='http://127.0.0.1:8088/mockPutOpsBinding',
def test_can_render_python_date(self): date = Date(2001, 10, 26) xmlelement = etree.Element('foo') xsd.Element(xsd.Date).render(xmlelement, 'bar', date) xml = self._normalize(etree.tostring(xmlelement, pretty_print=True)) assert_equals(b'<foo><bar>2001-10-26</bar></foo>', xml)
class PlaceU(xsd.ComplexType): Name = xsd.Element(xsd.String)
class AppHeaderU(xsd.ComplexType): Version = xsd.Element(xsd.String) Message = xsd.Element(GetWeatherByPlaceNameU)
class Container(xsd.ComplexType): value = xsd.Element(CodeType)
instance.ValideElServicioResult = ValideElServicioResult return instance Schema_c49e7 = xsd.Schema( imports=[], includes=[], targetNamespace=settings.FVA_HOST, elementFormDefault='qualified', simpleTypes=[], attributeGroups=[], groups=[], complexTypes=[RespuestaDeLaSolicitud], elements={ 'ExisteUnaSolicitudDeFirmaCompleta': xsd.Element(ExisteUnaSolicitudDeFirmaCompleta()), 'ExisteUnaSolicitudDeFirmaCompletaResponse': xsd.Element(ExisteUnaSolicitudDeFirmaCompletaResponse()), 'ValideElServicio': xsd.Element(ValideElServicio()), 'ValideElServicioResponse': xsd.Element(ValideElServicioResponse()) }, ) ############################################################################## # Methods ExisteUnaSolicitudDeFirmaCompleta_method = xsd.Method( soapAction=settings.FVA_HOST + 'ExisteUnaSolicitudDeFirmaCompleta', input='ExisteUnaSolicitudDeFirmaCompleta',
class AirporttDocument(xsd.Document): airport = xsd.Element(Airport)
class Test(xsd.ComplexType): value = xsd.Element(xsd.Integer, nillable=True) notnillable = xsd.Element(xsd.Integer, minOccurs=0)
class RequestResponseOperation(xsd.Group): input = xsd.Element(xsd.String, minOccurs=0) output = xsd.Element(xsd.String, minOccurs=0)
class Operation(xsd.ComplexType): name = xsd.Element(xsd.String) requestResponseOperation = xsd.Ref(RequestResponseOperation)
class A(xsd.ComplexType): name = xsd.Element(xsd.String, nillable=True)
class B(A): type = xsd.Element(xsd.String)
class Test(xsd.ComplexType): value = xsd.Element(xsd.Long)
class Ops(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence aircraft = xsd.Element(xsd.String) flight_number = xsd.Element(xsd.String) type = xsd.Element(xsd.String(enumeration=[ 'COMMERCIAL', 'INCOMPLETE', 'ENGINE_RUN_UP', 'TEST', 'TRAINING', 'FERRY', 'POSITIONING', 'LINE_TRAINING' ])) takeoff_airport = xsd.Element(Airport) takeoff_gate_datetime = xsd.Element(xsd.DateTime, minOccurs=0) takeoff_datetime = xsd.Element(xsd.DateTime) takeoff_fuel = xsd.Element(Weight, minOccurs=0) takeoff_gross_weight = xsd.Element(Weight, minOccurs=0) takeoff_pilot = xsd.Element(Pilot, minOccurs=0) landing_airport = xsd.Element(Airport) landing_gate_datetime = xsd.Element(xsd.DateTime, minOccurs=0) landing_datetime = xsd.Element(xsd.DateTime) landing_fuel = xsd.Element(Weight, minOccurs=0) landing_pilot = xsd.Element(Pilot, minOccurs=0) destination_airport = xsd.Element(Airport, minOccurs=0) captain_code = xsd.Element(xsd.String, minOccurs=0) first_officer_code = xsd.Element(xsd.String, minOccurs=0) V2 = xsd.Element(xsd.Integer, minOccurs=0) Vref = xsd.Element(xsd.Integer, minOccurs=0) Vapp = xsd.Element(xsd.Integer, minOccurs=0)
class Test(xsd.ComplexType): value = xsd.Element(xsd.Long, nillable=True)
class Status(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence action = xsd.Element(xsd.String(enumeration=['INSERTED', 'UPDATED', 'EXISTS'])) id = xsd.Element(xsd.Long)
class B1(xsd.ComplexType): a = xsd.Element("soapfish.xsd.String") b = xsd.Element("soapfish.xsd.Integer")
return instance Schema_09e57 = xsd.Schema( imports=[], includes=[], targetNamespace= 'urn://x-artefacts-smev-gov-ru/services/service-adapter/types/faults', location='${scheme}://${host}/smev-service-adapter-faults.xsd', elementFormDefault='qualified', simpleTypes=[String_50], attributeGroups=[], groups=[], complexTypes=[Fault], elements={ 'SystemFault': xsd.Element(Fault), 'ValidationFault': xsd.Element(Fault), 'SyncFault': xsd.Element(Fault) }, ) # XXX: Workaround for naming issues related to relative locations! Schema_33af9 = Schema_09e57 # urn://x-artefacts-smev-gov-ru/services/service-adapter/types class RejectCode(String_50): enumeration = ['ACCESS_DENIED', 'NO_DATA', 'UNKNOWN_REQUEST_DESCRIPTION']
class Test(xsd.ComplexType): value = xsd.Element(xsd.String(pattern=r"^a*$"))
class GetWeatherByPlaceName(xsd.ComplexType): Place = xsd.Element(Place) class AppHeader(xsd.ComplexType): Version = xsd.Element(xsd.String) Message = xsd.Element(GetWeatherByPlaceName) Schema_qualified = xsd.Schema( targetNamespace='http://www.example.org', elementFormDefault=xsd.ElementFormDefault.QUALIFIED, complexTypes=[GetWeatherByPlaceName, AppHeader, Place], elements={ 'GetWeatherByPlaceName': xsd.Element(GetWeatherByPlaceName), 'AppHeader': xsd.Element(AppHeader), 'Identity': xsd.Element(xsd.String), }, ) XMLSchema_qualified = etree.XMLSchema(generate_xsd(Schema_qualified)) class WsaAppHeader(wsa.Header): SCHEMA = Schema_qualified Identity = SCHEMA.get_element_by_name('Identity') class PlaceU(xsd.ComplexType): Name = xsd.Element(xsd.String)
class TestType(xsd.ComplexType): foo = xsd.Element(xsd.String, tagname='bar')
class GetWeatherByPlaceNameU(xsd.ComplexType): Place = xsd.Element(PlaceU)
class Status(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence action = xsd.Element(xsd.String(enumeration=['INSERTED', 'UPDATED', 'EXISTS'])) id = xsd.Element(xsd.Long) Schema = xsd.Schema( targetNamespace='http://flightdataservices.com/ops.xsd', simpleTypes=[Pilot], attributeGroups=[], groups=[], complexTypes=[Airport, Weight, Ops, Status], elements={'ops': xsd.Element(Ops), 'status': xsd.Element(Status)}) XML_REQUIRED_ONLY = ''' <ops:ops xmlns:ops="http://flightdataservices.com/ops.xsd"> <aircraft>N608WB</aircraft> <flight_number>123123</flight_number> <type>COMMERCIAL</type> <takeoff_airport> <code_type>ICAO</code_type> <code>EGLL</code> </takeoff_airport> <takeoff_gate_datetime>2009-12-30T21:35:59</takeoff_gate_datetime> <takeoff_datetime>2009-12-30T21:39:59</takeoff_datetime>
class Airport(xsd.ComplexType): type = xsd.Element(xsd.String) code = xsd.Element(xsd.String)
class Airport(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence code_type = xsd.Element(xsd.String(enumeration=['ICAO', 'IATA', 'FAA'])) code = xsd.Element(xsd.String)
class Ops(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence aircraft = xsd.Element(xsd.String) flight_number = xsd.Element(xsd.String) type = xsd.Element( xsd.String(enumeration=[ 'COMMERCIAL', 'INCOMPLETE', 'ENGINE_RUN_UP', 'TEST', 'TRAINING', 'FERRY', 'POSITIONING', 'LINE_TRAINING' ])) takeoff_airport = xsd.Element('Airport') takeoff_gate_datetime = xsd.Element(xsd.DateTime, minOccurs=0) takeoff_datetime = xsd.Element(xsd.DateTime) takeoff_fuel = xsd.Element('Weight', minOccurs=0) takeoff_gross_weight = xsd.Element('Weight', minOccurs=0) takeoff_pilot = xsd.Element('Pilot', minOccurs=0) landing_airport = xsd.Element('Airport') landing_gate_datetime = xsd.Element(xsd.DateTime, minOccurs=0) landing_datetime = xsd.Element(xsd.DateTime) landing_fuel = xsd.Element('Weight', minOccurs=0) landing_pilot = xsd.Element('Pilot', minOccurs=0) destination_airport = xsd.Element('Airport', minOccurs=0) captain_code = xsd.Element(xsd.String, minOccurs=0) first_officer_code = xsd.Element(xsd.String, minOccurs=0) V2 = xsd.Element(xsd.Integer, minOccurs=0) Vref = xsd.Element(xsd.Integer, minOccurs=0) Vapp = xsd.Element(xsd.Integer, minOccurs=0) @classmethod def create(cls, aircraft, flight_number, type, takeoff_airport, takeoff_datetime, landing_airport, landing_datetime): instance = cls() instance.aircraft = aircraft instance.flight_number = flight_number instance.type = type instance.takeoff_airport = takeoff_airport instance.takeoff_datetime = takeoff_datetime instance.landing_airport = landing_airport instance.landing_datetime = landing_datetime return instance
class Weight(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence value = xsd.Element(xsd.Integer) unit = xsd.Element(xsd.String(enumeration=['kg', 'lb']))
def test_wrong_type(self): mixed = xsd.Element(xsd.DateTime) xmlelement = etree.Element('foo') assert_raises(Exception, lambda: mixed.render(xmlelement, 'bar', 1))
class Test(xsd.ComplexType): value = xsd.Element(xsd.Decimal)