本文整理汇总了Python中XMLHelpers.clearGlobals方法的典型用法代码示例。如果您正苦于以下问题:Python XMLHelpers.clearGlobals方法的具体用法?Python XMLHelpers.clearGlobals怎么用?Python XMLHelpers.clearGlobals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLHelpers
的用法示例。
在下文中一共展示了XMLHelpers.clearGlobals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_grablinks2
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import clearGlobals [as 别名]
def test_grablinks2(self):
XMLHelpers.clearGlobals()
person = Element("person", {"id" : "globetrotter"})
ref = SubElement(person, "ref")
img = SubElement(ref, "image")
site = SubElement(img, "site")
site.text = "i'm a site"
title = SubElement(img, "title")
title.text = "i'm a title"
url = SubElement(img, "url")
url.text = "i'm a url"
description = SubElement(img, "description")
description.text = "i'm a description"
img2 = SubElement(ref, "video")
site2 = SubElement(img, "site")
site2.text = "youtube"
title2 = SubElement(img, "title")
title2.text = "dancing cats"
url2 = SubElement(img, "url")
url2.text = "http://youtube.com/watch?v=si7f8f7tiuhsfi"
description2 = SubElement(img, "description")
description2.text = "the cats are dancing!!!"
temp = XMLHelpers.grabLinks(person)
self.assert_(len(temp) == 2)
XMLHelpers.clearGlobals()
示例2: test_grablinks1
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import clearGlobals [as 别名]
def test_grablinks1(self):
XMLHelpers.clearGlobals()
crisis = Element("crisis", {"id" : "wow"})
ref = SubElement(crisis, "ref")
img = SubElement(ref, "image")
site = SubElement(img, "site")
site.text = "i'm a site"
title = SubElement(img, "title")
title.text = "i'm a title"
url = SubElement(img, "url")
url.text = "i'm a url"
description = SubElement(img, "description")
description.text = "i'm a description"
temp = XMLHelpers.grabLinks(crisis)
self.assert_(temp[0].link_site == "i'm a site")
XMLHelpers.clearGlobals()
示例3: test_grablinks3
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import clearGlobals [as 别名]
def test_grablinks3(self):
XMLHelpers.clearGlobals()
person = Element("person", {"id" : "globetrotter"})
temp = XMLHelpers.grabLinks(person)
self.assert_(len(temp) == 0)
XMLHelpers.clearGlobals()