本文整理汇总了Python中gluster.swift.common.DiskFile.Gluster_DiskFile._is_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Gluster_DiskFile._is_dir方法的具体用法?Python Gluster_DiskFile._is_dir怎么用?Python Gluster_DiskFile._is_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gluster.swift.common.DiskFile.Gluster_DiskFile
的用法示例。
在下文中一共展示了Gluster_DiskFile._is_dir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_close
# 需要导入模块: from gluster.swift.common.DiskFile import Gluster_DiskFile [as 别名]
# 或者: from gluster.swift.common.DiskFile.Gluster_DiskFile import _is_dir [as 别名]
def test_close(self):
assert not os.path.exists("/tmp/foo")
gdf = Gluster_DiskFile("/tmp/foo", "vol0", "p57", "ufo47", "bar",
"z", self.lg)
# Should be a no-op, as by default is_dir is False, but fp is None
gdf.close()
gdf._is_dir = True
gdf.fp = "123"
# Should still be a no-op as is_dir is True (marker directory)
gdf.close()
assert gdf.fp == "123"
gdf._is_dir = False
saved_dc = gluster.swift.common.DiskFile.do_close
self.called = False
def our_do_close(fp):
self.called = True
gluster.swift.common.DiskFile.do_close = our_do_close
try:
gdf.close()
assert self.called
assert gdf.fp is None
finally:
gluster.swift.common.DiskFile.do_close = saved_dc