本文整理汇总了Python中libvocab.Vocab.niceName方法的典型用法代码示例。如果您正苦于以下问题:Python Vocab.niceName方法的具体用法?Python Vocab.niceName怎么用?Python Vocab.niceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libvocab.Vocab
的用法示例。
在下文中一共展示了Vocab.niceName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testniceName_1foafmyprop
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import niceName [as 别名]
def testniceName_1foafmyprop(self):
"""simple test of nicename for a known namespace (FOAF), unknown property"""
foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT)
u = 'http://xmlns.com/foaf/0.1/myprop'
nn = foaf_spec.niceName(u)
# print "nicename for ",u," is: ",nn
self.failUnless(nn == 'foaf:myprop', "Didn't extract nicename. input is"+u+"output was"+nn)
示例2: testniceName_3baduri
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import niceName [as 别名]
def testniceName_3baduri(self):
"""niceName should return same string if passed a non-URI (but log a warning?)"""
foaf_spec = Vocab(FOAFSNAPSHOTDIR,FOAFSNAPSHOT)
foaf_spec.index()
u = 'thisisnotauri'
nn = foaf_spec.niceName(u)
# print "nicename for ",u," is: ",nn
self.failUnless(nn == u, "niceName didn't return same string when given a non-URI")
示例3: testniceName_3mystery
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import niceName [as 别名]
def testniceName_3mystery(self):
"""simple test of nicename for an unknown namespace"""
foaf_spec = Vocab(FOAFSNAPSHOTDIR,FOAFSNAPSHOT)
foaf_spec.index()
u = 'http:/example.com/mysteryns/myprop'
nn = foaf_spec.niceName(u)
# print "nicename for ",u," is: ",nn
self.failUnless(nn == 'http:/example.com/mysteryns/:myprop', "Didn't extract verbose nicename")
示例4: testniceName_2foafhomepage
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import niceName [as 别名]
def testniceName_2foafhomepage(self):
"""simple test of nicename for a known namespace (FOAF), known property."""
foaf_spec = Vocab(FOAFSNAPSHOTDIR,FOAFSNAPSHOT)
foaf_spec.index()
u = 'http://xmlns.com/foaf/0.1/homepage'
nn = foaf_spec.niceName(u)
# print "nicename for ",u," is: ",nn
self.failUnless(nn == 'foaf:homepage', "Didn't extract nicename")