本文整理汇总了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
开发者ID:ashleysommer,项目名称:spyne,代码行数:14,代码来源:test_xml_schema.py
示例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
开发者ID:wirewit,项目名称:spyne,代码行数:15,代码来源:test_xml_schema.py
示例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"
开发者ID:ashleysommer,项目名称:spyne,代码行数:16,代码来源:test_xml_schema.py
示例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"
开发者ID:ashleysommer,项目名称:spyne,代码行数:17,代码来源:test_xml_schema.py
示例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)
开发者ID:ashleysommer,项目名称:spyne,代码行数:17,代码来源:test_xml_schema.py
示例6: _get_schema
def _get_schema(self, *args):
schema_doc = get_schema_documents(args)['tns']
return parse_schema_element(schema_doc)
开发者ID:ashleysommer,项目名称:spyne,代码行数:3,代码来源:test_xml_schema.py
注:本文中的spyne.util.xml.parse_schema_element函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论