From 8e94419c2af8cb32b0125db79f3b78dbfb2862da Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 20 Jan 2015 14:34:42 -0800 Subject: [PATCH] Fix filefilter (#1186) tests for consistent colons I added this to the pretend output a few commits ago. --- beetsplug/filefilter.py | 7 ++++--- test/test_filefilter.py | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/beetsplug/filefilter.py b/beetsplug/filefilter.py index 84d694ef4..1a19d46cc 100644 --- a/beetsplug/filefilter.py +++ b/beetsplug/filefilter.py @@ -12,7 +12,8 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -"""Filters the imported files using a regular expression""" +"""Filter imported files using a regular expression. +""" import re from beets import config @@ -55,8 +56,8 @@ class FileFilterPlugin(BeetsPlugin): task.choice_flag = action.SKIP def file_filter(self, full_path): - """Checks if the configured regular expressions allow the import of the - file given in full_path. + """Checks if the configured regular expressions allow the import + of the file given in full_path. """ import_config = dict(config['import']) if 'singletons' not in import_config or not import_config[ diff --git a/test/test_filefilter.py b/test/test_filefilter.py index 21c080c81..0bc3826ca 100644 --- a/test/test_filefilter.py +++ b/test/test_filefilter.py @@ -64,7 +64,7 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): 'albumartist': None, 'mb_trackid': None, 'mb_albumid': None, - 'comp': None + 'comp': None, } self.album_paths = [] for i in range(count): @@ -118,13 +118,13 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): """ self.__reset_config() self.__run([ - 'Album %s' % displayable_path(self.artist_path), + 'Album: %s' % displayable_path(self.artist_path), ' %s' % displayable_path(self.artist_paths[0]), ' %s' % displayable_path(self.artist_paths[1]), - 'Album %s' % displayable_path(self.album_path), + 'Album: %s' % displayable_path(self.album_path), ' %s' % displayable_path(self.album_paths[0]), ' %s' % displayable_path(self.album_paths[1]), - 'Album %s' % displayable_path(self.misc_path), + 'Album: %s' % displayable_path(self.misc_path), ' %s' % displayable_path(self.misc_paths[0]), ' %s' % displayable_path(self.misc_paths[1]) ]) @@ -139,9 +139,9 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): self.__reset_config() config['filefilter']['path'] = '.*track_1.*\.mp3' self.__run([ - 'Album %s' % displayable_path(self.artist_path), + 'Album: %s' % displayable_path(self.artist_path), ' %s' % displayable_path(self.artist_paths[0]), - 'Album %s' % displayable_path(self.misc_path), + 'Album: %s' % displayable_path(self.misc_path), ' %s' % displayable_path(self.misc_paths[0]), ]) self.__run([ @@ -154,9 +154,9 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): self.__reset_config() config['filefilter']['album_path'] = '.*track_1.*\.mp3' self.__run([ - 'Album %s' % displayable_path(self.artist_path), + 'Album: %s' % displayable_path(self.artist_path), ' %s' % displayable_path(self.artist_paths[0]), - 'Album %s' % displayable_path(self.misc_path), + 'Album: %s' % displayable_path(self.misc_path), ' %s' % displayable_path(self.misc_paths[0]), ]) self.__run([ @@ -177,13 +177,13 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): 'Singleton: %s' % displayable_path(self.misc_paths[0]) ], singletons=True) self.__run([ - 'Album %s' % displayable_path(self.artist_path), + 'Album: %s' % displayable_path(self.artist_path), ' %s' % displayable_path(self.artist_paths[0]), ' %s' % displayable_path(self.artist_paths[1]), - 'Album %s' % displayable_path(self.album_path), + 'Album: %s' % displayable_path(self.album_path), ' %s' % displayable_path(self.album_paths[0]), ' %s' % displayable_path(self.album_paths[1]), - 'Album %s' % displayable_path(self.misc_path), + 'Album: %s' % displayable_path(self.misc_path), ' %s' % displayable_path(self.misc_paths[0]), ' %s' % displayable_path(self.misc_paths[1]) ]) @@ -194,9 +194,9 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): config['filefilter']['album_path'] = '.*track_1.*\.mp3' config['filefilter']['singleton_path'] = '.*track_2.*\.mp3' self.__run([ - 'Album %s' % displayable_path(self.artist_path), + 'Album: %s' % displayable_path(self.artist_path), ' %s' % displayable_path(self.artist_paths[0]), - 'Album %s' % displayable_path(self.misc_path), + 'Album: %s' % displayable_path(self.misc_path), ' %s' % displayable_path(self.misc_paths[0]), ]) self.__run([