本文整理汇总了Python中fs.memoryfs.MemoryFS.makeopendir方法的典型用法代码示例。如果您正苦于以下问题:Python MemoryFS.makeopendir方法的具体用法?Python MemoryFS.makeopendir怎么用?Python MemoryFS.makeopendir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fs.memoryfs.MemoryFS
的用法示例。
在下文中一共展示了MemoryFS.makeopendir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_movedir_indir
# 需要导入模块: from fs.memoryfs import MemoryFS [as 别名]
# 或者: from fs.memoryfs.MemoryFS import makeopendir [as 别名]
def test_movedir_indir(self):
"""Test movedir in a directory"""
fs1 = MemoryFS()
fs2 = MemoryFS()
fs1sub = fs1.makeopendir("from")
self._make_fs(fs1sub)
utils.movedir((fs1, "from"), (fs2, "copy"))
self.assert_(not fs1.exists("from"))
self._check_fs(fs2.opendir("copy"))
fs1 = TempFS()
fs2 = TempFS()
fs1sub = fs1.makeopendir("from")
self._make_fs(fs1sub)
utils.movedir((fs1, "from"), (fs2, "copy"))
self.assert_(not fs1.exists("from"))
self._check_fs(fs2.opendir("copy"))
示例2: test_movedir_root
# 需要导入模块: from fs.memoryfs import MemoryFS [as 别名]
# 或者: from fs.memoryfs.MemoryFS import makeopendir [as 别名]
def test_movedir_root(self):
"""Test movedir to root dir"""
fs1 = MemoryFS()
fs2 = MemoryFS()
fs1sub = fs1.makeopendir("from")
self._make_fs(fs1sub)
utils.movedir((fs1, "from"), fs2)
self.assert_(not fs1.exists("from"))
self._check_fs(fs2)
fs1 = TempFS()
fs2 = TempFS()
fs1sub = fs1.makeopendir("from")
self._make_fs(fs1sub)
utils.movedir((fs1, "from"), fs2)
self.assert_(not fs1.exists("from"))
self._check_fs(fs2)
示例3: TestWalk
# 需要导入模块: from fs.memoryfs import MemoryFS [as 别名]
# 或者: from fs.memoryfs.MemoryFS import makeopendir [as 别名]
class TestWalk(unittest.TestCase):
def setUp(self):
self.fs = MemoryFS()
self.fs.setcontents('a.txt', 'hello')
self.fs.setcontents('b.txt', 'world')
self.fs.makeopendir('foo').setcontents('c', '123')
self.fs.makeopendir('.svn').setcontents('ignored', '')
def test_wildcard(self):
for dir_path, paths in self.fs.walk(wildcard='*.txt'):
for path in paths:
self.assert_(path.endswith('.txt'))
for dir_path, paths in self.fs.walk(wildcard=lambda fn:fn.endswith('.txt')):
for path in paths:
self.assert_(path.endswith('.txt'))
def test_dir_wildcard(self):
for dir_path, paths in self.fs.walk(dir_wildcard=lambda fn:not fn.endswith('.svn')):
for path in paths:
self.assert_('.svn' not in path)
示例4: get_fs
# 需要导入模块: from fs.memoryfs import MemoryFS [as 别名]
# 或者: from fs.memoryfs.MemoryFS import makeopendir [as 别名]
def get_fs(cls, registry, fs_name, fs_name_params, fs_path, writeable, create_dir):
from fs.memoryfs import MemoryFS
memfs = MemoryFS()
if create_dir:
memfs = memfs.makeopendir(fs_path)
return memfs, None