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


Python SiteInfo.find_node方法代码示例

本文整理汇总了Python中hydeengine.siteinfo.SiteInfo.find_node方法的典型用法代码示例。如果您正苦于以下问题:Python SiteInfo.find_node方法的具体用法?Python SiteInfo.find_node怎么用?Python SiteInfo.find_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hydeengine.siteinfo.SiteInfo的用法示例。


在下文中一共展示了SiteInfo.find_node方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_filters

# 需要导入模块: from hydeengine.siteinfo import SiteInfo [as 别名]
# 或者: from hydeengine.siteinfo.SiteInfo import find_node [as 别名]
    def test_filters(self):
        site = SiteInfo(settings, TEST_SITE.path)
        for name in [".banjo", ".hidden", "junk.abc~"]:
            f = File(site.content_folder.child(name))
            self.files.append(f)
            f.write("junk")
        
        git = site.content_folder.child_folder(".git")
        git_child = git.child_folder("child")
        git_child_pack = File(git_child.child("pack"))
        git.make()
        git_child.make()
        git_index = File(git.child("index"))
        git_index.write("junk")
        git_child_pack.write("junk")
            
        original_exclude = settings.FILTER['exclude']
        original_include = settings.FILTER['include']
        settings.FILTER = {}
        site = SiteInfo(settings, TEST_SITE.path)
        site.refresh()
        
        for f in self.files:
            assert site.find_resource(f)
            
        assert site.find_node(git)
        assert site.find_resource(git_index)
        assert site.find_node(git_child)
        assert site.find_resource(git_child_pack)

        settings.FILTER = { 
            'include': (),
            'exclude': (".*","*~")
        }
        
        site = SiteInfo(settings, TEST_SITE.path)        
        site.refresh()
        
        for f in self.files:
            assert not site.find_resource(f)
            
        assert not site.find_node(git)
        assert not site.find_resource(git_index)  
        assert not site.find_node(git_child)
        assert not site.find_resource(git_child_pack)  
            
        settings.FILTER = { 
            'include': (".banjo",),
            'exclude': (".*","*~")
        }

        site = SiteInfo(settings, TEST_SITE.path)        
        site.refresh()

        for f in self.files:
            if f.name == ".banjo":
                assert site.find_resource(f)
            else:
                assert not site.find_resource(f)    
                
        assert not site.find_node(git)
        assert not site.find_resource(git_index)        
            
        settings.FILTER['exclude']  = original_exclude
        settings.FILTER['include']  = original_include
        
        self.files.append(git)
开发者ID:lachenmayer,项目名称:hyde,代码行数:69,代码来源:test_siteinfo.py


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