本文整理汇总了Python中spyne.util.xml.parse_schema_element函数的典型用法代码示例。如果您正苦于以下问题:Python parse_schema_element函数的具体用法?Python parse_schema_element怎么用?Python parse_schema_element使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_schema_element函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_boolean_default
def test_boolean_default(self):
tns = 'some_ns'
class SomeGuy(ComplexModel):
__namespace__ = tns
bald = Boolean(default=True)
schema = get_schema_documents([SomeGuy], tns)['tns']
print(etree.tostring(schema, pretty_print=True))
objects = parse_schema_element(schema)
pprint(objects[tns].types)
NewGuy = objects['some_ns'].types["SomeGuy"]
assert NewGuy._type_info['bald'].Attributes.default == True
示例2: test_attribute
def test_attribute(self):
tns = 'some_ns'
class SomeGuy(ComplexModel):
__namespace__ = tns
name = XmlAttribute(Unicode)
schema = get_schema_documents([SomeGuy], tns)['tns']
print etree.tostring(schema, pretty_print=True)
objects = parse_schema_element(schema)
pprint(objects[tns].types)
NewGuy = objects['some_ns'].types["SomeGuy"]
assert NewGuy._type_info['name'].type is Unicode
示例3: test_attribute_with_customized_type
def test_attribute_with_customized_type(self):
tns = 'some_ns'
class SomeGuy(ComplexModel):
__namespace__ = tns
name = XmlAttribute(Unicode(default="aa"))
schema = get_schema_documents([SomeGuy], tns)['tns']
print(etree.tostring(schema, pretty_print=True))
objects = parse_schema_element(schema)
pprint(objects[tns].types)
NewGuy = objects['some_ns'].types["SomeGuy"]
assert NewGuy._type_info['name'].type.__orig__ is Unicode
assert NewGuy._type_info['name'].type.Attributes.default == "aa"
示例4: test_customized_unicode
def test_customized_unicode(self):
tns = 'some_ns'
class SomeGuy(ComplexModel):
__namespace__ = tns
name = Unicode(max_len=10, pattern="a", min_len=5, default="aa")
schema = get_schema_documents([SomeGuy], tns)['tns']
print(etree.tostring(schema, pretty_print=True))
objects = parse_schema_element(schema)
pprint(objects[tns].types)
NewGuy = objects['some_ns'].types["SomeGuy"]
assert NewGuy._type_info['name'].Attributes.max_len == 10
assert NewGuy._type_info['name'].Attributes.min_len == 5
assert NewGuy._type_info['name'].Attributes.pattern == "a"
assert NewGuy._type_info['name'].Attributes.default == "aa"
示例5: test_simple
def test_simple(self):
tns = 'some_ns'
class SomeGuy(ComplexModel):
__namespace__ = 'some_ns'
id = Integer
schema = get_schema_documents([SomeGuy], tns)['tns']
print(etree.tostring(schema, pretty_print=True))
objects = parse_schema_element(schema)
pprint(objects[tns].types)
NewGuy = objects[tns].types["SomeGuy"]
assert NewGuy.get_type_name() == SomeGuy.get_type_name()
assert NewGuy.get_namespace() == SomeGuy.get_namespace()
assert dict(NewGuy._type_info) == dict(SomeGuy._type_info)
示例6: _get_schema
def _get_schema(self, *args):
schema_doc = get_schema_documents(args)['tns']
return parse_schema_element(schema_doc)