当前位置: 首页>>代码示例>>Python>>正文


Python XMLHelpers.grabLinks方法代码示例

本文整理汇总了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()
开发者ID:hychyc071,项目名称:cs373-wc1-tests,代码行数:29,代码来源:jromeem-TestWC1.py

示例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())
开发者ID:jromeem,项目名称:cs373-wc,代码行数:29,代码来源:TestWC1.py

示例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()
开发者ID:hychyc071,项目名称:cs373-wc1-tests,代码行数:19,代码来源:jromeem-TestWC1.py

示例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())
开发者ID:jromeem,项目名称:cs373-wc,代码行数:19,代码来源:TestWC1.py

示例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()
开发者ID:hychyc071,项目名称:cs373-wc1-tests,代码行数:8,代码来源:jromeem-TestWC1.py

示例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())
开发者ID:jromeem,项目名称:cs373-wc,代码行数:8,代码来源:TestWC1.py


注:本文中的XMLHelpers.grabLinks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。