コード例 #1
0
 def test_pop_dir(self):
     try:
         do1 = DirectoryObject("test_dir1", temporary=True)
         do2 = DirectoryObject("test_dir2", temporary=True)
         do2.append(do1)
         poped = do2.pop(0)
         if not isinstance(poped, FileObject) and \
                 not isinstance(poped, DirectoryObject):
             raise Exception("FileObject/DirectoryObject hasn't "
                             "been returned as copy")
         if do1.parent == do2 or do2.index(do1) is not None:
             raise Exception("Parent hasn't been unset")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #2
0
 def test_pop_file(self):
     try:
         fo = FileObject("test_file", temporary=True)
         do = DirectoryObject("test_dir", temporary=True)
         do.append(fo)
         poped = do.pop(0)
         if not isinstance(poped, FileObject) and \
                 not isinstance(poped, DirectoryObject):
             raise Exception("FileObject/DirectoryObject hasn't "
                             "been returned as copy")
         if fo.parent == do or do.index(fo) is not None:
             raise Exception("Parent hasn't been unset")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)