本文整理匯總了Python中rhsm.pathtree.PathTree.path_tree方法的典型用法代碼示例。如果您正苦於以下問題:Python PathTree.path_tree方法的具體用法?Python PathTree.path_tree怎麽用?Python PathTree.path_tree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rhsm.pathtree.PathTree
的用法示例。
在下文中一共展示了PathTree.path_tree方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_match_variable
# 需要導入模塊: from rhsm.pathtree import PathTree [as 別名]
# 或者: from rhsm.pathtree.PathTree import path_tree [as 別名]
def test_match_variable(self):
tree = {'foo': [{'$releasever': [{'bar':[{PATH_END: None}]}]}]}
data = open(DATA).read()
pt = PathTree(data)
# just swap out the pre-cooked data with out with
pt.path_tree = tree
self.assertTrue(pt.match_path('/foo/path/bar'))
self.assertFalse(pt.match_path('/foo/path/abc'))
示例2: test_match_path_listing
# 需要導入模塊: from rhsm.pathtree import PathTree [as 別名]
# 或者: from rhsm.pathtree.PathTree import path_tree [as 別名]
def test_match_path_listing(self):
tree = {'foo': [{'path': [{'bar':[{PATH_END: None}]}]}]}
data = open(DATA).read()
pt = PathTree(data)
pt.path_tree = tree
self.assertTrue(pt.match_path('/foo/path/bar/listing'))
self.assertTrue(pt.match_path('/foo/path/listing'))
self.assertTrue(pt.match_path('/foo/listing'))
self.assertFalse(pt.match_path('/foo/path/alfred'))
self.assertFalse(pt.match_path('/foo/path/listing/for/alfred'))
示例3: test_match_different_variables
# 需要導入模塊: from rhsm.pathtree import PathTree [as 別名]
# 或者: from rhsm.pathtree.PathTree import path_tree [as 別名]
def test_match_different_variables(self):
tree1 = {'foo': [{'$releasever': [{'bar':[{PATH_END: None}]}],
'jarjar': [{'binks':[{PATH_END: None}]}]}]}
tree2 = {'foo': [{'jarjar': [{'binks':[{PATH_END: None}]}],
'$releasever': [{'bar':[{PATH_END: None}]}]}]}
tree3 = {'foo': [{'$releasever': [{'bar':[{PATH_END: None}]}]},
{'jarjar': [{'binks':[{PATH_END: None}]}]}]}
tree4 = {'foo': [{'jarjar': [{'binks':[{PATH_END: None}]}]},
{'$releasever': [{'bar':[{PATH_END: None}]}]}]}
trees = [tree1, tree2, tree3, tree4]
data = open(DATA).read()
pt = PathTree(data)
#just swap out the pre-cooked data with out with
for tree in trees:
pt.path_tree = tree
self.assertTrue(pt.match_path('/foo/path/bar'))
self.assertFalse(pt.match_path('/foo/path/abc'))
self.assertFalse(pt.match_path('/foo/path/abc'))
self.assertTrue(pt.match_path('/foo/jarjar/binks'))
self.assertTrue(pt.match_path('/foo/jarjar/bar'))
self.assertFalse(pt.match_path('/foo/jarjar/notbinks'))