From 86f18935fe8ef5e6592e072e19c1aa644fb2c916 Mon Sep 17 00:00:00 2001 From: Lasse Bigum Date: Sat, 2 Nov 2013 02:43:12 +0100 Subject: [PATCH] Fix flake8 errors and add a few more tests --- mopidy/frontends/mpd/protocol/music_db.py | 6 ++---- tests/backends/local/library_test.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mopidy/frontends/mpd/protocol/music_db.py b/mopidy/frontends/mpd/protocol/music_db.py index 1c737520..972f5840 100644 --- a/mopidy/frontends/mpd/protocol/music_db.py +++ b/mopidy/frontends/mpd/protocol/music_db.py @@ -127,8 +127,8 @@ def findadd(context, mpd_query): @handle_request( - r'^list "?(?P([Aa]rtist|[Aa]lbumartist|[Aa]lbum|[Dd]ate|[Gg]enre))"?' - r'( (?P.*))?$') + r'^list "?(?P([Aa]rtist|[Aa]lbumartist|[Aa]lbum|[Dd]ate|' + r'[Gg]enre))"?( (?P.*))?$') def list_(context, field, mpd_query=None): """ *musicpd.org, music database section:* @@ -239,8 +239,6 @@ def _list_artist(context, query): def _list_albumartist(context, query): - import logging - logger = logging.getLogger('mopidy.backends.local') albumartists = set() results = context.core.library.find_exact(**query).get() for track in _get_tracks(results): diff --git a/tests/backends/local/library_test.py b/tests/backends/local/library_test.py index 061895d8..0e33b412 100644 --- a/tests/backends/local/library_test.py +++ b/tests/backends/local/library_test.py @@ -108,6 +108,9 @@ class LocalLibraryProviderTest(unittest.TestCase): result = self.library.find_exact(artist=['unknown artist']) self.assertEqual(list(result[0].tracks), []) + result = self.library.find_exact(albumartist=['unknown albumartist']) + self.assertEqual(list(result[0].tracks), []) + result = self.library.find_exact(album=['unknown artist']) self.assertEqual(list(result[0].tracks), []) @@ -225,6 +228,9 @@ class LocalLibraryProviderTest(unittest.TestCase): test = lambda: self.library.find_exact(artist=['']) self.assertRaises(LookupError, test) + test = lambda: self.library.find_exact(albumartist=['']) + self.assertRaises(LookupError, test) + test = lambda: self.library.find_exact(track=['']) self.assertRaises(LookupError, test) @@ -247,6 +253,9 @@ class LocalLibraryProviderTest(unittest.TestCase): result = self.library.search(artist=['unknown artist']) self.assertEqual(list(result[0].tracks), []) + result = self.library.search(albumartist=['unknown albumartist']) + self.assertEqual(list(result[0].tracks), []) + result = self.library.search(album=['unknown artist']) self.assertEqual(list(result[0].tracks), []) @@ -358,6 +367,9 @@ class LocalLibraryProviderTest(unittest.TestCase): test = lambda: self.library.search(artist=['']) self.assertRaises(LookupError, test) + test = lambda: self.library.search(albumartist=['']) + self.assertRaises(LookupError, test) + test = lambda: self.library.search(track=['']) self.assertRaises(LookupError, test)