本文整理汇总了Python中curdling.index.Index.ensure_path方法的典型用法代码示例。如果您正苦于以下问题:Python Index.ensure_path方法的具体用法?Python Index.ensure_path怎么用?Python Index.ensure_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curdling.index.Index
的用法示例。
在下文中一共展示了Index.ensure_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_index_ensure_path_for_existing_dirs
# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import ensure_path [as 别名]
def test_index_ensure_path_for_existing_dirs(patched_os):
"Test utility method Index.ensure_path() for existing directories"
# We'll need that inside of ensure_path()
patched_os.path.dirname = os.path.dirname
# Given that I have an index
index = Index('')
# When I call ensure_path(resource) against a directory that exists to
# exists, it *SHOULD NOT* try to create the directory
patched_os.path.isdir.return_value = True
index.ensure_path('path/to/my/resource')
patched_os.makedirs.called.should.be.false
示例2: test_index_ensure_path
# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import ensure_path [as 别名]
def test_index_ensure_path(patched_os):
"Test utility method Index.ensure_path()"
# We'll need that inside of ensure_path()
patched_os.path.dirname = os.path.dirname
# Given that I have an index
index = Index('')
# When I call ensure_path(resource) against a directory that doesn't seem
# to exist, it should try to create the directory for the resource
patched_os.path.isdir.return_value = False
index.ensure_path('path/to/my/resource')
patched_os.makedirs.assert_called_once_with('path/to/my')