class MozfileCopyContentsTestCase(unittest.TestCase): """Test our ability to copy the contents of directories"""
def _directory_is_subset(self, set_, subset_): """
Confirm that all the contents of 'subset_' are contained in'set_' """
names = os.listdir(subset_) for name in names:
full_set_path = os.path.join(set_, name)
full_subset_path = os.path.join(subset_, name) if os.path.isdir(full_subset_path):
self.assertTrue(os.path.isdir(full_set_path))
self._directory_is_subset(full_set_path, full_subset_path) elif os.path.islink(full_subset_path):
self.assertTrue(os.path.islink(full_set_path)) else:
self.assertTrue(os.stat(full_set_path))
def _directories_are_equal(self, dir1, dir2): """
Confirm that the contents of 'dir1' are the same as'dir2' """
names1 = os.listdir(dir1)
names2 = os.listdir(dir2)
self.assertTrue(len(names1) == len(names2)) for name in names1:
self.assertTrue(name in names2)
dir1_path = os.path.join(dir1, name)
dir2_path = os.path.join(dir2, name) if os.path.isdir(dir1_path):
self.assertTrue(os.path.isdir(dir2_path))
self._directories_are_equal(dir1_path, dir2_path) elif os.path.islink(dir1_path):
self.assertTrue(os.path.islink(dir2_path)) else:
self.assertTrue(os.stat(dir2_path))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.