本文整理汇总了Python中gitfs.views.current.CurrentView._full_path方法的典型用法代码示例。如果您正苦于以下问题:Python CurrentView._full_path方法的具体用法?Python CurrentView._full_path怎么用?Python CurrentView._full_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gitfs.views.current.CurrentView
的用法示例。
在下文中一共展示了CurrentView._full_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getattr
# 需要导入模块: from gitfs.views.current import CurrentView [as 别名]
# 或者: from gitfs.views.current.CurrentView import _full_path [as 别名]
def test_getattr(self):
mocked_full = MagicMock()
mocked_os = MagicMock()
mocked_stat = MagicMock()
mocked_repo = MagicMock()
mocked_stat.simple = "stat"
mocked_os.lstat.return_value = mocked_stat
mocked_full.return_value = "full_path"
mocked_repo._full_path = mocked_full
with patch.multiple('gitfs.views.current', os=mocked_os,
STATS=['simple']):
current = CurrentView(repo=mocked_repo, uid=1, gid=1,
repo_path="repo_path",
ignore=CachedIgnore())
current._full_path = mocked_full
result = current.getattr("path")
asserted_result = {
'st_uid': 1,
'st_gid': 1,
'simple': "stat"
}
assert result == asserted_result
mocked_os.lstat.assert_called_once_with("full_path")
mocked_full.assert_called_once_with("path")
示例2: test_readlink
# 需要导入模块: from gitfs.views.current import CurrentView [as 别名]
# 或者: from gitfs.views.current.CurrentView import _full_path [as 别名]
def test_readlink(self):
mocked_repo = MagicMock()
mocked_full_path = MagicMock()
mocked_full_path.return_value = "full path"
mocked_repo._full_path = mocked_full_path
with patch('gitfs.views.current.os') as mocked_os:
mocked_os.readlink.return_value = "done"
current = CurrentView(repo=mocked_repo, repo_path="repo_path",
ignore=CachedIgnore())
current._full_path = mocked_full_path
assert current.readlink("path") == "done"
示例3: test_open
# 需要导入模块: from gitfs.views.current import CurrentView [as 别名]
# 或者: from gitfs.views.current.CurrentView import _full_path [as 别名]
def test_open(self):
mocked_full = MagicMock(return_value="full_path")
mocked_repo = MagicMock(_full_path=mocked_full)
mocked_os = MagicMock()
mocked_os.open.return_value = 1
with patch.multiple('gitfs.views.current', os=mocked_os):
current = CurrentView(repo=mocked_repo,
repo_path="repo_path",
ignore=CachedIgnore())
current._full_path = mocked_full
current.writing = set([])
assert current.open("path/", os.O_WRONLY) == 1
mocked_os.open.assert_called_once_with("full_path", os.O_WRONLY)