当前位置: 首页>>代码示例>>Python>>正文


Python FSTransaction.commit方法代码示例

本文整理汇总了Python中esky.fstransact.FSTransaction.commit方法的典型用法代码示例。如果您正苦于以下问题:Python FSTransaction.commit方法的具体用法?Python FSTransaction.commit怎么用?Python FSTransaction.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在esky.fstransact.FSTransaction的用法示例。


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

示例1: test_copy_dir_over_file

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_copy_dir_over_file(self):
     self.setContents("dir1/file0", "zero zero zero")
     self.setContents("dir2", "actually a file")
     trn = FSTransaction()
     trn.copy(self.path("dir1"), self.path("dir2"))
     self.assertContents("dir1/file0", "zero zero zero")
     trn.commit()
     self.assertContents("dir2/file0", "zero zero zero")
     self.assertContents("dir1/file0", "zero zero zero")
开发者ID:orng,项目名称:esky,代码行数:11,代码来源:test_esky.py

示例2: test_copy_file

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_copy_file(self):
     self.setContents("file1", "hello world")
     trn = FSTransaction()
     trn.copy(self.path("file1"), self.path("file2"))
     self.assertContents("file1", "hello world")
     self.assertFalse(os.path.exists(self.path("file2")))
     trn.commit()
     self.assertContents("file1", "hello world")
     self.assertContents("file2", "hello world")
开发者ID:orng,项目名称:esky,代码行数:11,代码来源:test_esky.py

示例3: test_move_dir_over_file

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_move_dir_over_file(self):
     self.setContents("dir1/file0", "zero zero zero")
     self.setContents("dir2", "actually a file")
     trn = FSTransaction()
     trn.move(self.path("dir1"), self.path("dir2"))
     self.assertContents("dir1/file0", "zero zero zero")
     trn.commit()
     self.assertContents("dir2/file0", "zero zero zero")
     self.assertFalse(os.path.exists(self.path("dir1")))
开发者ID:orng,项目名称:esky,代码行数:11,代码来源:test_esky.py

示例4: test_move_file_with_unicode_name

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_move_file_with_unicode_name(self):
     self.setContents(u"file\N{SNOWMAN}", "hello world")
     trn = FSTransaction()
     trn.move(self.path(u"file\N{SNOWMAN}"), self.path("file2"))
     self.assertContents(u"file\N{SNOWMAN}", "hello world")
     self.assertFalse(os.path.exists(self.path("file2")))
     trn.commit()
     self.assertContents("file2", "hello world")
     self.assertFalse(os.path.exists(self.path(u"file\N{SNOWMAN}")))
开发者ID:orng,项目名称:esky,代码行数:11,代码来源:test_esky.py

示例5: test_no_move_outside_root

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_no_move_outside_root(self):
     self.setContents("file1", "hello world")
     trn = FSTransaction(self.testdir)
     trn.move(self.path("file1"), "file2")
     trn.commit()
     self.assertContents("file2", "hello world")
     trn = FSTransaction(self.testdir)
     self.assertRaises(ValueError, trn.move, self.path("file2"), "../file1")
     trn.abort()
开发者ID:orng,项目名称:esky,代码行数:11,代码来源:test_esky.py

示例6: test_copy_file_over_dir

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_copy_file_over_dir(self):
     self.setContents("file0", "zero zero zero")
     self.setContents("dir2/myfile", "hahahahaha!")
     trn = FSTransaction()
     trn.copy(self.path("file0"), self.path("dir2"))
     self.assertContents("file0", "zero zero zero")
     self.assertContents("dir2/myfile", "hahahahaha!")
     trn.commit()
     self.assertContents("dir2", "zero zero zero")
     self.assertContents("file0", "zero zero zero")
开发者ID:orng,项目名称:esky,代码行数:12,代码来源:test_esky.py

示例7: test_move_file_over_dir

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_move_file_over_dir(self):
     self.setContents("file0", "zero zero zero")
     self.setContents("dir2/myfile", "hahahahaha!")
     trn = FSTransaction()
     trn.move(self.path("file0"), self.path("dir2"))
     self.assertContents("file0", "zero zero zero")
     self.assertContents("dir2/myfile", "hahahahaha!")
     trn.commit()
     self.assertContents("dir2", "zero zero zero")
     self.assertFalse(os.path.exists(self.path("file0")))
开发者ID:orng,项目名称:esky,代码行数:12,代码来源:test_esky.py

示例8: test_remove

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_remove(self):
     self.setContents("dir1/file1", "hello there world")
     trn = FSTransaction()
     trn.remove(self.path("dir1/file1"))
     self.assertTrue(os.path.exists(self.path("dir1/file1")))
     trn.commit()
     self.assertFalse(os.path.exists(self.path("dir1/file1")))
     self.assertTrue(os.path.exists(self.path("dir1")))
     trn = FSTransaction()
     trn.remove(self.path("dir1"))
     trn.commit()
     self.assertFalse(os.path.exists(self.path("dir1")))
开发者ID:orng,项目名称:esky,代码行数:14,代码来源:test_esky.py

示例9: test_move_dir

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_move_dir(self):
     self.setContents("dir1/file1", "hello world")
     self.setContents("dir1/file2", "how are you?")
     self.setContents("dir1/subdir/file3", "fine thanks")
     trn = FSTransaction()
     trn.move(self.path("dir1"), self.path("dir2"))
     self.assertContents("dir1/file1", "hello world")
     self.assertFalse(os.path.exists(self.path("dir2")))
     trn.commit()
     self.assertContents("dir2/file1", "hello world")
     self.assertContents("dir2/file2", "how are you?")
     self.assertContents("dir2/subdir/file3", "fine thanks")
     self.assertFalse(os.path.exists(self.path("dir1")))
开发者ID:orng,项目名称:esky,代码行数:15,代码来源:test_esky.py

示例10: test_copy_dir_exists

# 需要导入模块: from esky.fstransact import FSTransaction [as 别名]
# 或者: from esky.fstransact.FSTransaction import commit [as 别名]
 def test_copy_dir_exists(self):
     self.setContents("dir1/file0", "zero zero zero")
     self.setContents("dir1/file1", "hello world")
     self.setContents("dir1/file2", "how are you?")
     self.setContents("dir1/subdir/file3", "fine thanks")
     self.setContents("dir2/file1", "different contents")
     self.setContents("dir2/file3", "a different file")
     self.setContents("dir1/subdir/file3", "fine thanks")
     trn = FSTransaction()
     trn.copy(self.path("dir1"), self.path("dir2"))
     self.assertContents("dir1/file1", "hello world")
     trn.commit()
     self.assertContents("dir2/file0", "zero zero zero")
     self.assertContents("dir2/file1", "hello world")
     self.assertContents("dir2/file2", "how are you?")
     self.assertFalse(os.path.exists(self.path("dir2/file3")))
     self.assertContents("dir2/subdir/file3", "fine thanks")
     self.assertContents("dir1/file0", "zero zero zero")
     self.assertContents("dir1/file1", "hello world")
     self.assertContents("dir1/file2", "how are you?")
     self.assertContents("dir1/subdir/file3", "fine thanks")
开发者ID:orng,项目名称:esky,代码行数:23,代码来源:test_esky.py


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