def test_copy_chmod(self):
     try:
         fo = FileObject("test", temporary=True)
         fo_copy = fo.copy("test_copy")
         fo_copy.chmod(0o644)
         if oct(os.stat(fo_copy.path).st_mode & 0o777) != oct(0o644):
             raise Exception("Wrong mode of copied file")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
 def test_copy(self):
     try:
         fo = FileObject("test", temporary=True)
         fo_copy = fo.copy("test_copy")
         if not isinstance(fo_copy, FileObject):
             raise Exception("FileObject hasn't been returned as copy")
         if not os.path.exists("test_copy"):
             raise Exception("Failed to copy")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)