コード例 #1
0
 def testListRecursivelyViaWalking(self):
     temp_dir = tempfile.mkdtemp(prefix=self.get_temp_dir())
     self._CreateDeepDirectoryStructure(temp_dir)
     expected = [
         ["", ["a.tfevents.1", "model.ckpt",]],
         ["foo", []],
         ["bar", ["b.tfevents.1", "red_herring.txt",]],
         ["bar/baz", ["c.tfevents.1", "d.tfevents.1",]],
         [
             "bar/quux",
             ["some_flume_output.txt", "some_more_flume_output.txt",],
         ],
         ["quuz", ["e.tfevents.1",]],
         ["quuz/garply", ["f.tfevents.1",]],
         ["quuz/garply/corge", ["g.tfevents.1",]],
         ["quuz/garply/grault", ["h.tfevents.1",]],
         ["waldo", []],
         ["waldo/fred", ["i.tfevents.1",]],
     ]
     for pair in expected:
         # If this is not the top-level directory, prepend the high-level
         # directory.
         pair[0] = os.path.join(temp_dir, pair[0]) if pair[0] else temp_dir
         pair[1] = [os.path.join(pair[0], f) for f in pair[1]]
     self._CompareFilesPerSubdirectory(
         expected, io_wrapper.ListRecursivelyViaWalking(temp_dir)
     )
コード例 #2
0
 def testListRecursivelyViaWalking(self):
     temp_dir = tempfile.mkdtemp(prefix=self.get_temp_dir())
     self._CreateDeepDirectoryStructure(temp_dir)
     expected = [
         ['', [
             'a.tfevents.1',
             'model.ckpt',
         ]],
         ['foo', []],
         ['bar', [
             'b.tfevents.1',
             'red_herring.txt',
         ]],
         ['bar/baz', [
             'c.tfevents.1',
             'd.tfevents.1',
         ]],
         [
             'bar/quux',
             [
                 'some_flume_output.txt',
                 'some_more_flume_output.txt',
             ]
         ],
         ['quuz', [
             'e.tfevents.1',
         ]],
         ['quuz/garply', [
             'f.tfevents.1',
         ]],
         ['quuz/garply/corge', [
             'g.tfevents.1',
         ]],
         ['quuz/garply/grault', [
             'h.tfevents.1',
         ]],
         ['waldo', []],
         ['waldo/fred', [
             'i.tfevents.1',
         ]],
     ]
     for pair in expected:
         # If this is not the top-level directory, prepend the high-level
         # directory.
         pair[0] = os.path.join(temp_dir, pair[0]) if pair[0] else temp_dir
         pair[1] = [os.path.join(pair[0], f) for f in pair[1]]
     self._CompareFilesPerSubdirectory(
         expected, io_wrapper.ListRecursivelyViaWalking(temp_dir))