Ejemplo n.º 1
0
 def test_traversal_callback_without_files(self):
     traverser.traversal_callback(None, 'dir' + sep + 'sub', [])
     self.assertEqual(1, traverser.globals.breadth)
     self.assertEqual(7, traverser.globals.now_length)
     self.assertEqual(7, traverser.globals.max_length)
     self.assertEqual(1, traverser.globals.now_depth)
     self.assertEqual(1, traverser.globals.max_depth)
     self.assertEqual(sep.join(['dir', 'sub']),
                      traverser.globals.longest_file)
     self.assertEqual('dir' + sep + 'sub', traverser.globals.deepest_path)
     self.assertFalse(self.update_mock.called)
Ejemplo n.º 2
0
 def test_traversal_callback_without_files(self):
     traverser.traversal_callback(None, 'dir' + sep + 'sub', [])
     self.assertEqual(1, traverser.globals.breadth)
     self.assertEqual(7, traverser.globals.now_length)
     self.assertEqual(7, traverser.globals.max_length)
     self.assertEqual(1, traverser.globals.now_depth)
     self.assertEqual(1, traverser.globals.max_depth)
     self.assertEqual(
         sep.join(['dir', 'sub']),
         traverser.globals.longest_file)
     self.assertEqual('dir' + sep + 'sub', traverser.globals.deepest_path)
     self.assertFalse(self.update_mock.called)
Ejemplo n.º 3
0
 def test_traversal_callback_non_incrementing_case_without_files(self):
     traverser.globals.max_length = 99
     traverser.globals.max_depth = 99
     traverser.traversal_callback(None, 'dir' + sep + 'sub', [])
     self.assertEqual(1, traverser.globals.breadth)
     self.assertEqual(99, traverser.globals.now_length)
     self.assertEqual(99, traverser.globals.max_length)
     self.assertEqual(99, traverser.globals.now_depth)
     self.assertEqual(99, traverser.globals.max_depth)
     self.assertEqual('', traverser.globals.longest_file)
     self.assertEqual('', traverser.globals.deepest_path)
     self.assertFalse(self.update_mock.called)
Ejemplo n.º 4
0
 def test_traversal_callback_runas_program(self):
     traverser.globals.runas_program = True
     traverser.traversal_callback(None, 'dir' + sep + 'sub', ['file'])
     self.assertEqual(1, traverser.globals.breadth)
     self.assertEqual(12, traverser.globals.now_length)
     self.assertEqual(12, traverser.globals.max_length)
     self.assertEqual(1, traverser.globals.now_depth)
     self.assertEqual(1, traverser.globals.max_depth)
     self.assertEqual(sep.join(['dir', 'sub', 'file']),
                      traverser.globals.longest_file)
     self.assertEqual('dir' + sep + 'sub', traverser.globals.deepest_path)
     self.update_mock.assert_called_once_with(1, 12, 1)
Ejemplo n.º 5
0
 def test_traversal_callback_non_incrementing_case_without_files(self):
     traverser.globals.max_length = 99
     traverser.globals.max_depth = 99
     traverser.traversal_callback(
         None, 'dir' + sep + 'sub', [])
     self.assertEqual(1, traverser.globals.breadth)
     self.assertEqual(99, traverser.globals.now_length)
     self.assertEqual(99, traverser.globals.max_length)
     self.assertEqual(99, traverser.globals.now_depth)
     self.assertEqual(99, traverser.globals.max_depth)
     self.assertEqual('', traverser.globals.longest_file)
     self.assertEqual('', traverser.globals.deepest_path)
     self.assertFalse(self.update_mock.called)
Ejemplo n.º 6
0
 def test_traversal_callback_runas_program(self):
     traverser.globals.runas_program = True
     traverser.traversal_callback(None, 'dir' + sep + 'sub', ['file'])
     self.assertEqual(1, traverser.globals.breadth)
     self.assertEqual(12, traverser.globals.now_length)
     self.assertEqual(12, traverser.globals.max_length)
     self.assertEqual(1, traverser.globals.now_depth)
     self.assertEqual(1, traverser.globals.max_depth)
     self.assertEqual(
         sep.join(['dir', 'sub', 'file']),
         traverser.globals.longest_file)
     self.assertEqual('dir' + sep + 'sub', traverser.globals.deepest_path)
     self.update_mock.assert_called_once_with(1, 12, 1)