[#4 state:fixed] Filters are now applied on the whole file path.

This commit is contained in:
Virgil Dupras 2010-04-13 11:40:20 +02:00
parent 3ed5e1bf95
commit ff891c210c
2 changed files with 5 additions and 1 deletions

View File

@ -147,7 +147,7 @@ class Results(Markable):
self.__filters.append(filter_str)
if self.__filtered_dupes is None:
self.__filtered_dupes = flatten(g[:] for g in self.groups)
self.__filtered_dupes = set(dupe for dupe in self.__filtered_dupes if filter_re.search(dupe.name))
self.__filtered_dupes = set(dupe for dupe in self.__filtered_dupes if filter_re.search(unicode(dupe.path)))
filtered_groups = set()
for dupe in self.__filtered_dupes:
filtered_groups.add(self.get_group_of_duplicate(dupe))

View File

@ -570,6 +570,10 @@ class TCResultsXML(TestCase):
self.results.load_from_xml(f, self.get_file)
first(self.results.groups[0].matches).percentage
def test_apply_filter_works_on_paths(self):
# apply_filter() searches on the whole path, not just on the filename.
self.results.apply_filter(u'basepath')
eq_(len(self.results.groups), 2)
class TCResultsFilter(TestCase):
def setUp(self):