def test_exclusion_glob(self): groups = find_dupe_files(TEST_DATA_DIR, exclusion_globs=['*.txt'], min_group_size=1) self.assertEqual(len(groups), 1) for group in groups: self.assertEqual(len(group), 1) self.assertEqual(group[0].name, 'unique.gif')
def test_glob_and_size(self): groups = find_dupe_files(TEST_DATA_DIR, globs=['*.txt'], min_size=7, max_size=9) self.assertEqual(len(groups), 1) for group in groups: self.assertEqual(len(group), 4) self.assertEqual(group[0].name, '8bytes.txt')
def test_files_8_bytes_or_larger(self): groups = find_dupe_files(TEST_DATA_DIR, min_size=8) self.assertEqual(len(groups), 2) for group in groups: self.assertEqual(len(group), 4) self.assertTrue(group[0].name in ["8bytes.txt", "12bytes.txt"])
def test_files_larger_than_8_bytes(self): groups = find_dupe_files(TEST_DATA_DIR, min_size=9) self.assertEqual(len(groups), 1) self.assertEqual(len(groups[0]), 4) self.assertEqual(groups[0][0].name, "12bytes.txt")
def test_files_smaller_than_8_bytes(self): groups = find_dupe_files(TEST_DATA_DIR, max_size=7) self.assertEqual(1, len(groups)) self.assertEqual(4, len(groups[0])) self.assertEqual("empty.txt", groups[0][0].name)
def test_only_empty_files(self): groups = find_dupe_files(TEST_DATA_DIR, max_size=0) self.assertEqual(1, len(groups)) self.assertEqual(4, len(groups[0])) self.assertEqual("empty.txt", groups[0][0].name)
def test_filter_empty_files(self): groups = find_dupe_files(TEST_DATA_DIR, min_size=1) for group in groups: self.assertFalse(group[0].name == "empty.txt")