Ejemplo n.º 1
0
 def testListdir(self):
     temp_dir = self.get_temp_dir()
     self._CreateDeepDirectoryStructure(temp_dir)
     expected_files = (
         "foo",
         "bar",
         "quuz",
         "a.tfevents.1",
         "model.ckpt",
         "waldo",
     )
     six.assertCountEqual(self, expected_files, gfile.listdir(temp_dir))
Ejemplo n.º 2
0
 def testListdir(self):
     temp_dir = tempfile.mkdtemp(prefix=self.base_temp_dir)
     self._CreateDeepDirectoryStructure(temp_dir)
     expected_files = (
         'foo',
         'bar',
         'quuz',
         'a.tfevents.1',
         'model.ckpt',
         'waldo',
     )
     six.assertCountEqual(self, expected_files, gfile.listdir(temp_dir))
Ejemplo n.º 3
0
 def testListDirectory(self):
     dir_path = os.path.join(self._base_dir, "test_dir")
     gfile.makedirs(dir_path)
     files = ["file1.txt", "file2.txt", "file3.txt"]
     for name in files:
         file_path = os.path.join(dir_path, name)
         gfile.GFile(file_path, mode="w").write("testing")
     subdir_path = os.path.join(dir_path, "sub_dir")
     gfile.makedirs(subdir_path)
     subdir_file_path = os.path.join(subdir_path, "file4.txt")
     gfile.GFile(subdir_file_path, mode="w").write("testing")
     dir_list = gfile.listdir(dir_path)
     self.assertItemsEqual(files + ["sub_dir"], dir_list)
Ejemplo n.º 4
0
 def testListdir(self):
     temp_dir = self._CreateDeepS3Structure()
     self._CreateDeepS3Structure(temp_dir)
     expected_files = [
         # Empty directory not returned
         # 'foo',
         'bar',
         'quuz',
         'a.tfevents.1',
         'model.ckpt',
         'waldo',
     ]
     gotten_files = gfile.listdir(temp_dir)
     six.assertCountEqual(self, expected_files, gotten_files)
Ejemplo n.º 5
0
 def testListdir(self):
     temp_dir = self._CreateDeepS3Structure()
     self._CreateDeepS3Structure(temp_dir)
     expected_files = [
         # Empty directory not returned
         # 'foo',
         "bar",
         "quuz",
         "a.tfevents.1",
         "model.ckpt",
         "waldo",
     ]
     gotten_files = gfile.listdir(temp_dir)
     six.assertCountEqual(self, expected_files, gotten_files)
Ejemplo n.º 6
0
 def testListDirectoryFailure(self):
     dir_path = os.path.join(self._base_dir, "test_dir")
     with self.assertRaises(errors.NotFoundError):
         gfile.listdir(dir_path)