def validateASCII(self): """Validate ASCII files using difflib.""" (measured, expected) = self.validate() if not os.path.isabs(measured): measured = FileFinder.Instance().getFullPath(measured) if not os.path.isabs(expected): expected = FileFinder.Instance().getFullPath(expected) measured = self.__prepASCIIFile(measured) expected = self.__prepASCIIFile(expected) # calculate the difference diff = difflib.Differ().compare(measured, expected) result = [] for line in diff: if line.startswith('+') or line.startswith('-') or line.startswith('?'): result.append(line) # print the difference if len(result) > 0: if self.stripWhitespace: msg = "(whitespace striped from ends)" else: msg = "" print("******************* Difference in files", msg) print("\n".join(result)) print("*******************") return False else: return True
def find_file(filename=None): """ Calculates path of filename with the testing data. Path is determined in the platform independent way. :param filename: name of file to find :return: full path for the file with the testing data """ from mantid.api import FileFinder return FileFinder.Instance().getFullPath(filename)