本文整理汇总了Python中XMLHelpers.grabLinks方法的典型用法代码示例。如果您正苦于以下问题:Python XMLHelpers.grabLinks方法的具体用法?Python XMLHelpers.grabLinks怎么用?Python XMLHelpers.grabLinks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLHelpers
的用法示例。
在下文中一共展示了XMLHelpers.grabLinks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_grablinks2
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import grabLinks [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_grablinks2
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import grabLinks [as 别名]
def test_grablinks2(self):
db.delete(db.Query())
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 = "http://img.timeinc.net/time/photoessays/2010/haiti_time_z/haiti_time_z_01.jpg"
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!!!"
linkList = XMLHelpers.grabLinks(person)
self.assert_(len(linkList) == 1)
db.delete(db.Query())
示例3: test_grablinks1
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import grabLinks [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()
示例4: test_grablinks1
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import grabLinks [as 别名]
def test_grablinks1(self):
db.delete(db.Query())
crisis = Element("crisis", {"id" : "wow"})
ref = SubElement(crisis, "ref")
img = SubElement(ref, "image")
site = SubElement(img, "site")
site.text = "http://img.timeinc.net"
title = SubElement(img, "title")
title.text = "i'm a title"
url = SubElement(img, "url")
url.text = "http://img.timeinc.net/time/photoessays/2010/haiti_time_z/haiti_time_z_01.jpg"
description = SubElement(img, "description")
description.text = "i'm a description"
linkList = XMLHelpers.grabLinks(crisis)
self.assertEqual(linkList[0].link_site, "http://img.timeinc.net")
db.delete(db.Query())
示例5: test_grablinks3
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import grabLinks [as 别名]
def test_grablinks3(self):
XMLHelpers.clearGlobals()
person = Element("person", {"id" : "globetrotter"})
temp = XMLHelpers.grabLinks(person)
self.assert_(len(temp) == 0)
XMLHelpers.clearGlobals()
示例6: test_grablinks3
# 需要导入模块: import XMLHelpers [as 别名]
# 或者: from XMLHelpers import grabLinks [as 别名]
def test_grablinks3(self):
db.delete(db.Query())
person = Element("person", {"id" : "globetrotter"})
linkList = XMLHelpers.grabLinks(person)
self.assert_(len(linkList) == 0)
db.delete(db.Query())