當前位置: 首頁>>代碼示例>>Python>>正文


Python PathTree.path_tree方法代碼示例

本文整理匯總了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'))
開發者ID:vritant,項目名稱:python-rhsm,代碼行數:10,代碼來源:pathtree-tests.py

示例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'))
開發者ID:belonesox,項目名稱:python-rhsm,代碼行數:12,代碼來源:pathtree-tests.py

示例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'))
開發者ID:vritant,項目名稱:python-rhsm,代碼行數:23,代碼來源:pathtree-tests.py


注:本文中的rhsm.pathtree.PathTree.path_tree方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。