def testDiffs(self): for p in self.nodelist_pairs: print p s = patch(self.nodelist_paths[p[0]], self.nodediff_paths[p[1]]) diff = diff_nodelists(s, self.nodelist_paths[p[1]]) diff_lines = ''.join(diff) if len(diff_lines) != 0: if not os.path.isdir('errors'): os.mkdir('errors') open(os.path.join('errors', 'error.diff'), 'w').writelines(diff_lines) open(os.path.join('errors', 'error.nodelist'), 'w').writelines(s) shutil.copy(self.nodelist_paths[p[0]], os.path.join('errors', 'original.nodelist')) shutil.copy(self.nodelist_paths[p[1]], os.path.join('errors', 'correct.nodelist')) shutil.copy(self.nodediff_paths[p[1]], os.path.join('errors', 'original.nodediff')) self.assertEqual(len(diff_lines), 0)
def test_diff(self): s = patch(self.nodefile_path, self.nodediff_path) diff = diff_nodelists(s, self.comparison_path) diff_lines = ''.join(diff) self.assertEqual(len(diff_lines), 0)