• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python standarddir._init_cachedir_tag函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中qutebrowser.utils.standarddir._init_cachedir_tag函数的典型用法代码示例。如果您正苦于以下问题:Python _init_cachedir_tag函数的具体用法?Python _init_cachedir_tag怎么用?Python _init_cachedir_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_open_oserror

 def test_open_oserror(self, caplog, tmpdir, mocker, monkeypatch):
     """Test creating a new CACHEDIR.TAG."""
     monkeypatch.setattr(standarddir, 'cache', lambda: str(tmpdir))
     mocker.patch('builtins.open', side_effect=OSError)
     with caplog.at_level(logging.ERROR, 'init'):
         standarddir._init_cachedir_tag()
     assert caplog.messages == ['Failed to create CACHEDIR.TAG']
     assert not tmpdir.listdir()
开发者ID:mehak,项目名称:qutebrowser,代码行数:8,代码来源:test_standarddir.py


示例2: test_open_oserror

 def test_open_oserror(self, caplog, tmpdir, mocker, monkeypatch):
     """Test creating a new CACHEDIR.TAG."""
     monkeypatch.setattr('qutebrowser.utils.standarddir.cache',
                         lambda: str(tmpdir))
     mocker.patch('builtins.open', side_effect=OSError)
     with caplog.at_level(logging.ERROR, 'init'):
         standarddir._init_cachedir_tag()
     assert len(caplog.records) == 1
     assert caplog.records[0].message == 'Failed to create CACHEDIR.TAG'
     assert not tmpdir.listdir()
开发者ID:Dietr1ch,项目名称:qutebrowser,代码行数:10,代码来源:test_standarddir.py


示例3: test_existent_cache_dir_tag

 def test_existent_cache_dir_tag(self, tmpdir, mocker, monkeypatch):
     """Test with an existent CACHEDIR.TAG."""
     monkeypatch.setattr(standarddir, 'cache', lambda: str(tmpdir))
     mocker.patch('builtins.open', side_effect=AssertionError)
     m = mocker.patch('qutebrowser.utils.standarddir.os')
     m.path.join.side_effect = os.path.join
     m.path.exists.return_value = True
     standarddir._init_cachedir_tag()
     assert not tmpdir.listdir()
     m.path.exists.assert_called_with(str(tmpdir / 'CACHEDIR.TAG'))
开发者ID:michaelbeaumont,项目名称:qutebrowser,代码行数:10,代码来源:test_standarddir.py


示例4: test_new_cache_dir_tag

 def test_new_cache_dir_tag(self, tmpdir, mocker, monkeypatch):
     """Test creating a new CACHEDIR.TAG."""
     monkeypatch.setattr(standarddir, 'cache', lambda: str(tmpdir))
     standarddir._init_cachedir_tag()
     assert tmpdir.listdir() == [(tmpdir / 'CACHEDIR.TAG')]
     data = (tmpdir / 'CACHEDIR.TAG').read_text('utf-8')
     assert data == textwrap.dedent("""
         Signature: 8a477f597d28d172789f06886806bc55
         # This file is a cache directory tag created by qutebrowser.
         # For information about cache directory tags, see:
         #  http://www.brynosaurus.com/cachedir/
     """).lstrip()
开发者ID:michaelbeaumont,项目名称:qutebrowser,代码行数:12,代码来源:test_standarddir.py


示例5: test_no_cache_dir

 def test_no_cache_dir(self, mocker, monkeypatch):
     """Smoke test with cache() returning None."""
     monkeypatch.setattr('qutebrowser.utils.standarddir.cache',
                         lambda: None)
     mocker.patch('builtins.open', side_effect=AssertionError)
     standarddir._init_cachedir_tag()
开发者ID:Dietr1ch,项目名称:qutebrowser,代码行数:6,代码来源:test_standarddir.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python standarddir.cache函数代码示例发布时间:2022-05-26
下一篇:
Python qtutils.version_check函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap