本文整理汇总了Python中Base.buildCases方法的典型用法代码示例。如果您正苦于以下问题:Python Base.buildCases方法的具体用法?Python Base.buildCases怎么用?Python Base.buildCases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base.buildCases方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkWhiteSpaceInUnknownContent
# 需要导入模块: import Base [as 别名]
# 或者: from Base import buildCases [as 别名]
<doc>
<foo/>
</doc>"""
doc = self.parse(TEXT)
for node in doc.documentElement.childNodes:
if node.nodeType == xml.dom.Node.TEXT_NODE:
if not node.isWhitespaceInElementContent:
self.fail("founc whitespace node not identified"
" as whitespace-in-element-contnet")
def checkWhiteSpaceInUnknownContent(self, subset=""):
TEXT = """<!DOCTYPE doc %s>
<doc>
<foo/>
</doc>""" % subset
doc = self.parse(TEXT)
for node in doc.documentElement.childNodes:
if node.nodeType == xml.dom.Node.TEXT_NODE:
if node.isWhitespaceInElementContent:
self.fail("founc whitespace node in mixed content marked"
" as whitespace-in-element-contnet")
def _checkWhiteSpaceInMixedContent(self):
# XXX this test is confused
self.checkWhiteSpaceInUnknownContent("""[
<!ELEMENT doc (#PCDATA | foo)*>
]""")
cases = Base.buildCases(__name__, 'Core', '3.0')
示例2: checkWithoutNamespaceDeclarations
# 需要导入模块: import Base [as 别名]
# 或者: from Base import buildCases [as 别名]
self.assert_(docelem.getAttributeNode("tal:attr").namespaceURI is None)
self.assert_(docelem.getAttributeNode("tal:attr").prefix is None)
elem = docelem.firstChild
self.assert_(elem.namespaceURI is None)
self.assert_(elem.prefix is None)
def checkWithoutNamespaceDeclarations(self):
doc = self._parse("<doc xmlns='foo' xmlns:tal='bar' tal:attr='value'>"
"<tal:element tal:attr2='another'/>"
"</doc>",
{"namespace-declarations": 0})
docelem = doc.documentElement
self.failIf(docelem.hasAttribute("xmlns"))
self.failIf(docelem.hasAttribute("xmlns:tal"))
self.assert_(docelem.attributes.length == 1)
# We can't just name this parse(), since the framework overwrites
# that name on the actual instances.
#
def _parse(self, source, flags={}):
b = self.createBuilder()
for feature, value in flags.items():
b.setFeature(feature, value)
fp = StringIO(source)
inpsrc = self.implementation.createDOMInputSource()
inpsrc.byteStream = fp
return b.parse(inpsrc)
cases = Base.buildCases(__name__, "LS-Load", "3.0")