test_file_handler.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:PlasoScaffolder 作者: ClaudiaSaxer 项目源码 文件源码
def testCopyFile(self):
    """Tests if the copying of a file none existing beforhand works."""
    expected_content = "this is test content."

    with tempfile.TemporaryDirectory() as tmpdir:
      source = os.path.join(tmpdir, self.file)
      destination = os.path.join(tmpdir, "copy", self.file)

      with open(source, "a") as f:
        f.write(expected_content)

      handler = file_handler.FileHandler()
      self.assertFalse(os.path.exists(destination))
      handler.CopyFile(source, destination)
      self.assertTrue(os.path.exists(destination))
      self.assertTrue(filecmp.cmp(destination, source))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号