Did I find the right examples for you? yes no

All Samples(7)  |  Call(7)  |  Derive(0)  |  Import(0)
Inspect a list of the form [[item, hash, mtime], [item, hash, mtime]]
and return a tuple of (True|False, Message). True in the tuple indicates
a match, if False, the message will contain the mismatches.

        def verify_files(file_list):
    """Inspect a list of the form [[item, hash, mtime], [item, hash, mtime]]
    and return a tuple of (True|False, Message). True in the tuple indicates
    a match, if False, the message will contain the mismatches.
    """
    print 'Verifying {0} items'.format(len(file_list))
    success = True
    message = []
    for src, check, mtime in file_list:
        print ' ... {0}'.format(src)
        try:
            new_check = get_hash(src)
            new_mtime = os.path.getmtime(src)
            if not check == new_check:
                success = False
                message.append("Hash mismatch on {src}. Actual: {act} "
                               "Expected: {exp}".format(act=check,
                                                        exp=new_check,
                                                        src=src))
            if not int(mtime) == int(new_mtime):
                success = False
                message.append("Mtime mismatch on {src}. Actual: {act} "
                               "Expected: {exp}".format(act=mtime,
                                                        exp=new_mtime,
                                                        src=src))
        except Exception as err:
            msg = 'Failed to read {0}: {1}'.format(src, err)
            message.append(msg)
            print msg
            success = False
    return success, '\n'.join(message)
        


src/d/e/DedupeCopy-0.3.6/dedupe_copy/test/test_copy.py   DedupeCopy(Download)
                path_rules=['*:no_change'])
        # verify we didn't alter the existing data
        result, notes = utils.verify_files(self.file_data)
        self.assertTrue(result, 'Altered original files: {0}'.format(notes))
        # verify the copied data
        for file_info in self.file_data:
            file_info[0] = file_info[0].replace(self.temp_dir, copy_to_path, 1)
        result, notes = utils.verify_files(self.file_data)
                path_rules=None)
        # verify we didn't alter the existing data
        result, notes = utils.verify_files(self.file_data)
        self.assertTrue(result, 'Altered original files: {0}'.format(notes))
        # verify the copied data
                                                  copy_to_path,
                                                  ['extension', 'mtime'])
        result, notes = utils.verify_files(self.file_data)
        self.assertTrue(result, 'Failed to copy files: {0}'.format(notes))
 
                path_rules=['*:no_change'], keep_empty=False)
        # verify we didn't alter the existing data
        result, notes = utils.verify_files(self.file_data)
        self.assertTrue(result, 'Altered original files: {0}'.format(notes))
        # verify we copied only one file: