diff --git a/.prospector.yml b/.prospector.yml index f936313f3..2d89f5d2a 100644 --- a/.prospector.yml +++ b/.prospector.yml @@ -8,7 +8,6 @@ pep8: - E129 - E226 - E241 - - E265 - E402 - E501 - W503 diff --git a/picard/album.py b/picard/album.py index 9a36eb270..715e01f46 100644 --- a/picard/album.py +++ b/picard/album.py @@ -518,7 +518,7 @@ class Album(DataObject, Item): for file in list(files): if file.state == File.REMOVED: continue - # if we have a recordingid to match against, use that in priority + # if we have a recordingid to match against, use that in priority recid = recordingid or file.metadata['musicbrainz_recordingid'] if recid and mbid_validate(recid): if not tracks_cache: diff --git a/picard/const/languages.py b/picard/const/languages.py index 13a08424d..2ea7f5e30 100644 --- a/picard/const/languages.py +++ b/picard/const/languages.py @@ -25,13 +25,13 @@ # List of available user interface languages UI_LANGUAGES = [ - #('af', 'Afrikaans', N_('Afrikaans')), + # ('af', 'Afrikaans', N_('Afrikaans')), ('ar', 'العربية', N_('Arabic')), - #('ast', 'Asturian', N_('Asturian')), - #('bg', 'Български', N_('Bulgarian')), + # ('ast', 'Asturian', N_('Asturian')), + # ('bg', 'Български', N_('Bulgarian')), ('ca', 'Català', N_('Catalan')), ('cs', 'Čeština', N_('Czech')), - #('cy', 'Cymraeg', N_('Welsh')), + # ('cy', 'Cymraeg', N_('Welsh')), ('da', 'Dansk', N_('Danish')), ('de', 'Deutsch', N_('German')), ('de_CH', 'Deutsch (Schweiz)', N_('German (Switzerland)')), @@ -40,29 +40,29 @@ UI_LANGUAGES = [ ('en_AU', 'English (Australia)', N_('English (Australia)')), ('en_CA', 'English (Canada)', N_('English (Canada)')), ('en_GB', 'English (UK)', N_('English (UK)')), - #('eo', 'Esperanto', N_('Esperanto')), + # ('eo', 'Esperanto', N_('Esperanto')), ('es', 'Español', N_('Spanish')), ('et', 'Eesti', N_('Estonian')), - #('fa', 'فارسی', N_('Persian')), + # ('fa', 'فارسی', N_('Persian')), ('fi', 'Suomi', N_('Finnish')), - #('fo', 'Føroyskt', N_('Faroese')), + # ('fo', 'Føroyskt', N_('Faroese')), ('fr', 'Français', N_('French')), ('fr_CA', 'Français canadien', N_('French (Canada)')), - #('fy', 'Frysk', N_('Frisian')), + # ('fy', 'Frysk', N_('Frisian')), ('gl', 'Galego', N_('Galician')), ('he', 'עברית', N_('Hebrew')), - #('hi', 'हिन्दी', N_('Hindi')), + # ('hi', 'हिन्दी', N_('Hindi')), ('hu', 'Magyar', N_('Hungarian')), - #('id', 'Bahasa Indonesia', N_('Indonesian')), + # ('id', 'Bahasa Indonesia', N_('Indonesian')), ('is', 'Íslenska', N_('Icelandic')), ('it', 'Italiano', N_('Italian')), ('ja', '日本語', N_('Japanese')), - #('kn', 'ಕನ್ನಡ', N_('Kannada')), + # ('kn', 'ಕನ್ನಡ', N_('Kannada')), ('ko', '한국어', N_('Korean')), - #('lt', 'Lietuvių', N_('Lithuanian')), + # ('lt', 'Lietuvių', N_('Lithuanian')), ('ms_MY', 'Bahasa Melayu (Malaysia)', N_('Malay (Malaysia)')), ('nb', 'Norsk bokmål', N_('Norwegian Bokmål')), - #('nds', 'Plattdüütsch', N_('Low German')), + # ('nds', 'Plattdüütsch', N_('Low German')), ('nl', 'Nederlands', N_('Dutch')), ('oc', 'Occitan', N_('Occitan')), ('pl', 'Polski', N_('Polish')), @@ -70,13 +70,13 @@ UI_LANGUAGES = [ ('pt_BR', 'Português do Brasil', N_('Brazilian Portuguese')), ('ro', 'Română', N_('Romanian')), ('ru', 'Pyccĸий', N_('Russian')), - #('sco', 'Scots leid', N_('Scots')), + # ('sco', 'Scots leid', N_('Scots')), ('sk', 'Slovenčina', N_('Slovak')), ('sl', 'Slovenščina', N_('Slovenian')), ('sq', 'Shqip', N_('Albanian')), - #('sr', 'Србин', N_('Serbian')), + # ('sr', 'Србин', N_('Serbian')), ('sv', 'Svenska', N_('Swedish')), - #('ta', 'தமிழ்', N_('Tamil')), + # ('ta', 'தமிழ்', N_('Tamil')), ('tr', 'Türkçe', N_('Turkish')), ('uk', 'Украї́нська мо́ва', N_('Ukrainian')), ('zh_CN', '中文(中国大陆)', N_('Chinese (China)')), diff --git a/picard/coverart/__init__.py b/picard/coverart/__init__.py index dc8f69bb5..4f9e0f044 100644 --- a/picard/coverart/__init__.py +++ b/picard/coverart/__init__.py @@ -79,8 +79,8 @@ class CoverArt: for track in self.album._new_tracks: track.metadata.images.append(coverartimage) # If the image already was a front image, - # there might still be some other non-CAA front - # images in the queue - ignore them. + # there might still be some other non-CAA front + # images in the queue - ignore them. if not self.front_image_found: self.front_image_found = coverartimage.is_front_image() else: diff --git a/picard/coverart/image.py b/picard/coverart/image.py index 75953b8d7..dbffd0d24 100644 --- a/picard/coverart/image.py +++ b/picard/coverart/image.py @@ -272,7 +272,7 @@ class CoverArtImage: """ if self.is_front_image() or not self.types or 'front' in self.types: return 'front' - # TODO: do something better than randomly using the first in the list + # TODO: do something better than randomly using the first in the list return self.types[0] def _make_image_filename(self, filename, dirname, _metadata): diff --git a/picard/coverart/providers/__init__.py b/picard/coverart/providers/__init__.py index 991a19604..f7ecc39e1 100644 --- a/picard/coverart/providers/__init__.py +++ b/picard/coverart/providers/__init__.py @@ -76,7 +76,7 @@ def register_cover_art_provider(provider): register_options_page(provider.OPTIONS) -# named tuples used by cover_art_providers() +# named tuples used by cover_art_providers() ProviderTuple = namedtuple('ProviderTuple', 'name title enabled cls') PInfoTuple = namedtuple('PInfoTuple', 'position enabled') POrderTuple = namedtuple('OrderTuple', 'name position enabled') @@ -94,7 +94,7 @@ def cover_art_providers(): order[o.name] = PInfoTuple(position=o.position, enabled=o.enabled) # use previously built dict to order providers, according to current ca_providers - # (yet) unknown providers are placed at the end, disabled + # (yet) unknown providers are placed at the end, disabled ordered_providers = sorted(_cover_art_providers, key=lambda p: order[p.name].position) def label(p): @@ -152,8 +152,8 @@ class CoverArtProvider(metaclass=CoverArtProviderMetaClass): return not self.coverart.front_image_found def queue_images(self): - # this method has to return CoverArtProvider.FINISHED or - # CoverArtProvider.WAIT + # this method has to return CoverArtProvider.FINISHED or + # CoverArtProvider.WAIT raise NotImplementedError def error(self, msg): @@ -163,7 +163,7 @@ class CoverArtProvider(metaclass=CoverArtProviderMetaClass): self.coverart.queue_put(what) def next_in_queue(self): - # must be called by provider if queue_images() returns WAIT + # must be called by provider if queue_images() returns WAIT self.coverart.next_in_queue() def match_url_relations(self, relation_types, func): diff --git a/picard/coverart/providers/caa.py b/picard/coverart/providers/caa.py index 8a27cb197..3cdb8d051 100644 --- a/picard/coverart/providers/caa.py +++ b/picard/coverart/providers/caa.py @@ -610,7 +610,7 @@ class CoverArtProviderCaa(CoverArtProvider): image["image"]) continue # if image has no type set, we still want it to match - # pseudo type 'unknown' + # pseudo type 'unknown' if not image["types"]: image["types"] = ["unknown"] else: diff --git a/picard/coverart/providers/caa_release_group.py b/picard/coverart/providers/caa_release_group.py index b38080bd9..7b1cdfe02 100644 --- a/picard/coverart/providers/caa_release_group.py +++ b/picard/coverart/providers/caa_release_group.py @@ -41,7 +41,7 @@ class CoverArtProviderCaaReleaseGroup(CoverArtProviderCaa): NAME = "CaaReleaseGroup" TITLE = N_("CAA Release Group") - # FIXME: caa release group uses the same options than caa + # FIXME: caa release group uses the same options than caa OPTIONS = None ignore_json_not_found_error = True diff --git a/picard/disc.py b/picard/disc.py index 031ab3d7d..6f5ccbcfd 100644 --- a/picard/disc.py +++ b/picard/disc.py @@ -39,11 +39,11 @@ from picard.ui.cdlookup import CDLookupDialog try: - # use python-libdiscid (http://pythonhosted.org/python-libdiscid/) + # use python-libdiscid (http://pythonhosted.org/python-libdiscid/) from libdiscid.compat import discid except ImportError: try: - # use python-discid (http://python-discid.readthedocs.org/en/latest/) + # use python-discid (http://python-discid.readthedocs.org/en/latest/) import discid except (ImportError, OSError): discid = None diff --git a/picard/file.py b/picard/file.py index 7413dbfd1..39a4485a1 100644 --- a/picard/file.py +++ b/picard/file.py @@ -268,7 +268,7 @@ class File(QtCore.QObject, Item): # https://docs.python.org/3/library/os.html#os.utime # Since Python 3.3, ns parameter is available # The best way to preserve exact times is to use the st_atime_ns and st_mtime_ns - # fields from the os.stat() result object with the ns parameter to utime. + # fields from the os.stat() result object with the ns parameter to utime. st = os.stat(filename) except OSError as why: errmsg = "Couldn't read timestamps from %r: %s" % (filename, why) @@ -497,7 +497,7 @@ class File(QtCore.QObject, Item): new_path = os.path.dirname(new_filename) old_path = os.path.dirname(old_filename) if new_path == old_path: - # skip, same directory, nothing to move + # skip, same directory, nothing to move return patterns = config.setting["move_additional_files_pattern"] pattern_regexes = set() diff --git a/picard/pluginmanager.py b/picard/pluginmanager.py index edd7024a6..db2575707 100644 --- a/picard/pluginmanager.py +++ b/picard/pluginmanager.py @@ -208,7 +208,7 @@ class PluginManager(QtCore.QObject): return if plugindir == self.plugins_directory: # .update trick is only for plugins installed through the Picard UI - # and only for plugins in plugins_directory (USER_PLUGIN_DIR by default) + # and only for plugins in plugins_directory (USER_PLUGIN_DIR by default) self.handle_plugin_updates() # now load found plugins names = set() diff --git a/picard/ui/itemviews.py b/picard/ui/itemviews.py index 9791ecbcb..7c2a5f419 100644 --- a/picard/ui/itemviews.py +++ b/picard/ui/itemviews.py @@ -566,7 +566,7 @@ class BaseTreeView(QtWidgets.QTreeWidget): menu.addSeparator() # Using type here is intentional. isinstance will return true for the - # NatAlbum instance, which can't be part of a collection. + # NatAlbum instance, which can't be part of a collection. # pylint: disable=C0123 selected_albums = [a for a in self.window.selected_objects if type(a) == Album] if selected_albums: diff --git a/picard/ui/mainwindow.py b/picard/ui/mainwindow.py index 588ba01a7..f86757c46 100644 --- a/picard/ui/mainwindow.py +++ b/picard/ui/mainwindow.py @@ -367,7 +367,7 @@ class MainWindow(QtWidgets.QMainWindow, PreserveGeometry): return hasattr(obj, 'keys') and hasattr(obj, '__getitem__') echo = kwargs.get('echo', log.debug) - # _ is defined using builtins.__dict__, so setting it as default named argument + # _ is defined using builtins.__dict__, so setting it as default named argument # value doesn't work as expected translate = kwargs.get('translate', _) timeout = kwargs.get('timeout', 0) diff --git a/picard/ui/options/genres.py b/picard/ui/options/genres.py index c802a2099..57a77c989 100644 --- a/picard/ui/options/genres.py +++ b/picard/ui/options/genres.py @@ -104,7 +104,7 @@ class GenresOptionsPage(OptionsPage): self.ui.test_genres_filter.setToolTip(_(TOOLTIP_TEST_GENRES_FILTER)) self.ui.test_genres_filter.textChanged.connect(self.update_test_genres_filter) - #FIXME: colors aren't great from accessibility POV + # FIXME: colors aren't great from accessibility POV self.fmt_keep = QTextBlockFormat() self.fmt_keep.setBackground(Qt.green) @@ -140,7 +140,7 @@ class GenresOptionsPage(OptionsPage): filters = self.ui.genres_filter.toPlainText() tagfilter = TagGenreFilter(filters) - #FIXME: very simple error reporting, improve + # FIXME: very simple error reporting, improve self.ui.label_test_genres_filter_error.setText( "\n".join( [_("Error line %d: %s") % (lineno + 1, error) for lineno, error in tagfilter.errors.items()] @@ -150,7 +150,7 @@ class GenresOptionsPage(OptionsPage): def set_line_fmt(lineno, textformat): obj = self.ui.test_genres_filter if lineno < 0: - #use current cursor position + # use current cursor position cursor = obj.textCursor() else: cursor = QTextCursor(obj.document().findBlockByNumber(lineno)) diff --git a/picard/ui/options/interface_colors.py b/picard/ui/options/interface_colors.py index 6664acd35..bcfc50f38 100644 --- a/picard/ui/options/interface_colors.py +++ b/picard/ui/options/interface_colors.py @@ -67,7 +67,7 @@ class ColorButton(QtWidgets.QPushButton): def delete_items_of_layout(layout): # Credits: - # https://stackoverflow.com/a/45790404 + # https://stackoverflow.com/a/45790404 # https://riverbankcomputing.com/pipermail/pyqt/2009-November/025214.html if layout is not None: while layout.count(): diff --git a/picard/util/__init__.py b/picard/util/__init__.py index 03e01ee4a..a087d83a6 100644 --- a/picard/util/__init__.py +++ b/picard/util/__init__.py @@ -88,9 +88,9 @@ _io_encoding = sys.getfilesystemencoding() # The following was adapted from k3b's source code: -#// On a glibc system the system locale defaults to ANSI_X3.4-1968 -#// It is very unlikely that one would set the locale to ANSI_X3.4-1968 -#// intentionally +# On a glibc system the system locale defaults to ANSI_X3.4-1968 +# It is very unlikely that one would set the locale to ANSI_X3.4-1968 +# intentionally def check_io_encoding(): if _io_encoding == "ANSI_X3.4-1968": from picard import log @@ -319,9 +319,9 @@ def uniqify(seq): _tracknum_regexps = ( # search for explicit track number (prefix "track") r"track[\s_-]*(?:no|nr)?[\s_-]*(\d+)", - # search for 2-digit number at start of string + # search for 2-digit number at start of string r"^(\d{2})\D?", - # search for 2-digit number at end of string + # search for 2-digit number at end of string r"\D?(\d{2})$", ) diff --git a/picard/util/imageinfo.py b/picard/util/imageinfo.py index f14aadf4e..a58e5b0df 100644 --- a/picard/util/imageinfo.py +++ b/picard/util/imageinfo.py @@ -64,7 +64,7 @@ def identify(data): mime = '' extension = '' - # http://en.wikipedia.org/wiki/Graphics_Interchange_Format + # http://en.wikipedia.org/wiki/Graphics_Interchange_Format if data[:6] in (b'GIF87a', b'GIF89a'): w, h = struct.unpack(' 79 characters) # W503: line break occurred before a binary operator -ignore = E127,E128,E129,E226,E241,E265,E402,E501,W503 +ignore = E127,E128,E129,E226,E241,E402,E501,W503 builtins = _,N_,ngettext,gettext_attributes,gettext_countries,string_ exclude = ui_*.py,picard/resources.py diff --git a/test/test_amazon_urls.py b/test/test_amazon_urls.py index 2d5f5150a..160588001 100644 --- a/test/test_amazon_urls.py +++ b/test/test_amazon_urls.py @@ -47,27 +47,24 @@ class ParseAmazonUrlTest(PicardTestCase): self.assertEqual(r, expected) def test_4(self): - #incorrect ASIN - url = 'http://www.amazon.com/dp/A20530902X' - expected = None - r = parse_amazon_url(url) - self.assertEqual(r, expected) - - def test_5(self): - #incorrect ASIN - url = 'http://www.amazon.com/dp/020530902x' - expected = None - r = parse_amazon_url(url) - self.assertEqual(r, expected) - - def test_6(self): url = 'https://www.amazon.co.jp/gp/product/B00005FMYV' expected = {'asin': 'B00005FMYV', 'host': 'amazon.co.jp'} r = parse_amazon_url(url) self.assertEqual(r, expected) - def test_7(self): - #incorrect url scheme + def test_incorrect_asin_1(self): + url = 'http://www.amazon.com/dp/A20530902X' + expected = None + r = parse_amazon_url(url) + self.assertEqual(r, expected) + + def test_incorrect_asin_2(self): + url = 'http://www.amazon.com/dp/020530902x' + expected = None + r = parse_amazon_url(url) + self.assertEqual(r, expected) + + def test_incorrect_url_scheme(self): url = 'httpsa://www.amazon.co.jp/gp/product/B00005FMYV' expected = None r = parse_amazon_url(url) diff --git a/test/test_bytes2human.py b/test/test_bytes2human.py index 5f9b23d38..ac4cf0edc 100644 --- a/test/test_bytes2human.py +++ b/test/test_bytes2human.py @@ -81,7 +81,6 @@ class Testbytes2human(PicardTestCase): if create_test_data: self._save_expected_to(filename, testlist) expected = self._read_expected_from(filename) - #self.maxDiff = None self.assertEqual(testlist, expected) if create_test_data: # be sure it is disabled diff --git a/test/test_config.py b/test/test_config.py index 67864926a..e5e8dfe34 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -113,7 +113,7 @@ class TestPicardConfigTextOption(TestPicardConfigCommon): def test_text_opt_invalid_value(self): TextOption("setting", "text_option", "abc") - # store invalid value in config file directly + # store invalid value in config file directly self.config.setValue('setting/text_option', object) self.assertEqual(self.config.setting["text_option"], 'abc') @@ -164,14 +164,14 @@ class TestPicardConfigBoolOption(TestPicardConfigCommon): def test_bool_opt_set_direct_str(self): BoolOption("setting", "bool_option", False) - # store invalid bool value in config file directly + # store invalid bool value in config file directly self.config.setValue('setting/bool_option', 'yes') self.assertEqual(self.config.setting["bool_option"], True) def test_bool_opt_set_direct_str_true(self): BoolOption("setting", "bool_option", False) - # store 'true' directly, it should be ok, due to conversion + # store 'true' directly, it should be ok, due to conversion self.config.setValue('setting/bool_option', 'true') self.assertEqual(self.config.setting["bool_option"], True) @@ -215,14 +215,14 @@ class TestPicardConfigIntOption(TestPicardConfigCommon): def test_int_opt_direct_invalid(self): IntOption("setting", "int_option", 666) - # store invalid int value in config file directly + # store invalid int value in config file directly self.config.setValue('setting/int_option', 'x333') self.assertEqual(self.config.setting["int_option"], 666) def test_int_opt_direct_validstr(self): IntOption("setting", "int_option", 666) - # store int as string directly, it should be ok, due to conversion + # store int as string directly, it should be ok, due to conversion self.config.setValue('setting/int_option', '333') self.assertEqual(self.config.setting["int_option"], 333) @@ -266,14 +266,14 @@ class TestPicardConfigFloatOption(TestPicardConfigCommon): def test_float_opt_direct_invalid(self): FloatOption("setting", "float_option", 666.6) - # store invalid float value in config file directly + # store invalid float value in config file directly self.config.setValue('setting/float_option', '333.3x') self.assertEqual(self.config.setting["float_option"], 666.6) def test_float_opt_direct_validstr(self): FloatOption("setting", "float_option", 666.6) - # store float as string directly, it should be ok, due to conversion + # store float as string directly, it should be ok, due to conversion self.config.setValue('setting/float_option', '333.3') self.assertEqual(self.config.setting["float_option"], 333.3) @@ -324,7 +324,7 @@ class TestPicardConfigListOption(TestPicardConfigCommon): def test_list_opt_direct_invalid(self): ListOption("setting", "list_option", ["a", "b"]) - # store invalid list value in config file directly + # store invalid list value in config file directly self.config.setValue('setting/list_option', 'efg') self.assertEqual(self.config.setting["list_option"], ["a", "b"]) @@ -368,6 +368,6 @@ class TestPicardConfigVarOption(TestPicardConfigCommon): def test_var_opt_invalid_value(self): Option("setting", "var_option", set(["a", "b"])) - # store invalid value in config file directly + # store invalid value in config file directly self.config.setValue('setting/var_option', object) self.assertEqual(self.config.setting["var_option"], set(["a", "b"])) diff --git a/test/test_coverartprovider_caa.py b/test/test_coverartprovider_caa.py index b4e70d130..3b347ba8e 100644 --- a/test/test_coverartprovider_caa.py +++ b/test/test_coverartprovider_caa.py @@ -35,16 +35,15 @@ class CoverArtImageProviderCaaTest(PicardTestCase): self.assertEqual(result, expect, msg=msgfmt % (size, sizes, result, expect)) # For historical reasons, caa web service returns 2 identical urls, - # for 2 different keys (250/small, 500/large) - # Here is an example of the json relevant part: + # for 2 different keys (250/small, 500/large) + # Here is an example of the json relevant part: # "thumbnails": { # "250": "http://coverartarchive.org/release/d20247ad-940e-486d-948f-be4c17024ab9/24885128253-250.jpg", # "500": "http://coverartarchive.org/release/d20247ad-940e-486d-948f-be4c17024ab9/24885128253-500.jpg", - #  "1200": "http://coverartarchive.org/release/d20247ad-940e-486d-948f-be4c17024ab9/24885128253-1200.jpg", - #  "large": "http://coverartarchive.org/release/d20247ad-940e-486d-948f-be4c17024ab9/24885128253-500.jpg", + # "1200": "http://coverartarchive.org/release/d20247ad-940e-486d-948f-be4c17024ab9/24885128253-1200.jpg", + # "large": "http://coverartarchive.org/release/d20247ad-940e-486d-948f-be4c17024ab9/24885128253-500.jpg", # "small": "http://coverartarchive.org/release/d20247ad-940e-486d-948f-be4c17024ab9/24885128253-250.jpg" # }, - #  sizes = ("250", "500", "1200", "large", "small") expectations = { 50: [], @@ -71,7 +70,7 @@ class CoverArtImageProviderCaaTest(PicardTestCase): do_tests(sizes, expectations) # In the future, large and small might be removed or new size added - # test if we can handle that (through size aliases) + # test if we can handle that (through size aliases) sizes = ("small", "large", "1200", "2000", "unknownsize") expectations = { 50: [], diff --git a/test/test_file.py b/test/test_file.py index 0117f2d54..c43a745bc 100644 --- a/test/test_file.py +++ b/test/test_file.py @@ -120,9 +120,9 @@ class TestPreserveTimes(PicardTestCase): # test if times are preserved (before_atime_ns, before_mtime_ns) = self.file._preserve_times(self.file.filename, self._modify_testfile) - # HERE an external access to the file is possible, modifying its access time + # HERE an external access to the file is possible, modifying its access time - # read times again and compare with original + # read times again and compare with original st = os.stat(self.file.filename) (after_atime_ns, after_mtime_ns) = (st.st_atime_ns, st.st_mtime_ns) @@ -135,11 +135,11 @@ class TestPreserveTimes(PicardTestCase): after_atime_ns //= 1000 after_mtime_ns //= 1000 - # modification times should be equal + # modification times should be equal self.assertEqual(before_mtime_ns, after_mtime_ns) # access times may not be equal - # time difference should be positive and reasonably low (if no access in between, it should be 0) + # time difference should be positive and reasonably low (if no access in between, it should be 0) delta = after_atime_ns - before_atime_ns tolerance = 10**7 #  0.01 seconds self.assertTrue(0 <= delta < tolerance, "0 <= %s < %s" % (delta, tolerance)) diff --git a/test/test_imagelist.py b/test/test_imagelist.py index 093616c2b..57aea56f1 100644 --- a/test/test_imagelist.py +++ b/test/test_imagelist.py @@ -300,10 +300,10 @@ class ImageListTest(PicardTestCase): "save_images_to_tags": True, "embed_only_one_front_image": False, } - # save all but no images + # save all but no images self.assertEqual(list(to_be_saved(settings)), []) - # save all, only one non-front image in the list + # save all, only one non-front image in the list self.imagelist.append(self.images['a']) self.assertEqual(list(to_be_saved(settings)), [self.images['a']]) @@ -311,11 +311,11 @@ class ImageListTest(PicardTestCase): self.imagelist.append(self.images['b']) self.assertEqual(list(to_be_saved(settings)), [self.images['a'], self.images['b']]) - # save only one front, 2 images, one of them is a front image (b) + # save only one front, 2 images, one of them is a front image (b) settings["embed_only_one_front_image"] = True self.assertEqual(list(to_be_saved(settings)), [self.images['b']]) - # save only one front, 3 images, two of them have front type (b & c) + # save only one front, 3 images, two of them have front type (b & c) self.imagelist.append(self.images['c']) self.assertEqual(list(to_be_saved(settings)), [self.images['b']]) @@ -323,7 +323,7 @@ class ImageListTest(PicardTestCase): settings["save_images_to_tags"] = False self.assertEqual(list(to_be_saved(settings)), []) - # settings is missing a setting + # settings is missing a setting del settings["save_images_to_tags"] with self.assertRaises(KeyError): next(to_be_saved(settings)) @@ -333,7 +333,7 @@ class ImageListTest(PicardTestCase): self.imagelist.append(self.images['b']) self.imagelist.append(self.images['c']) - # strip front images from list, only a isn't + # strip front images from list, only a isn't self.assertEqual(len(self.imagelist), 3) self.imagelist.strip_front_images() self.assertNotIn(self.images['b'], self.imagelist) diff --git a/test/test_metadata.py b/test/test_metadata.py index 15eaa2459..848469ef6 100644 --- a/test/test_metadata.py +++ b/test/test_metadata.py @@ -373,11 +373,11 @@ class MetadataTest(PicardTestCase): self.assertRaises(KeyError, m.getraw, 'a') self.assertIn('a', m.deleted_tags) - # NOTE: historic behavior of Metadata.delete() - # an attempt to delete an non-existing tag, will add it to the list - # of deleted tags - # so this will not raise a KeyError - # as is it differs from dict or even defaultdict behavior + # NOTE: historic behavior of Metadata.delete() + # an attempt to delete an non-existing tag, will add it to the list + # of deleted tags + # so this will not raise a KeyError + # as is it differs from dict or even defaultdict behavior del m['unknown'] self.assertIn('unknown', m.deleted_tags) @@ -424,7 +424,7 @@ class MetadataTest(PicardTestCase): self._check_mapping_update(m) def test_metadata_mapping_update_tuple(self): - # update from tuple + # update from tuple m = self.metadata_d2 d2 = (('c', 3), ('d', ['u', 'w']), ('x', '')) @@ -433,27 +433,27 @@ class MetadataTest(PicardTestCase): self._check_mapping_update(m) def test_metadata_mapping_update_dictlike(self): - # update from kwargs + # update from kwargs m = self.metadata_d2 m.update(c=3, d=['u', 'w'], x='') self._check_mapping_update(m) def test_metadata_mapping_update_noparam(self): - # update without parameter + # update without parameter m = self.metadata_d2 self.assertRaises(TypeError, m.update) self.assertEqual(m['a'], 'b') def test_metadata_mapping_update_intparam(self): - # update without parameter + # update without parameter m = self.metadata_d2 self.assertRaises(TypeError, m.update, 123) def test_metadata_mapping_update_strparam(self): - # update without parameter + # update without parameter m = self.metadata_d2 self.assertRaises(ValueError, m.update, 'abc') diff --git a/test/test_plugins.py b/test/test_plugins.py index 6bb960145..283d0f6ed 100644 --- a/test/test_plugins.py +++ b/test/test_plugins.py @@ -124,7 +124,7 @@ class TestPicardPluginManager(TestPicardPluginsCommon): result = _compatible_api_versions(api_versions) self.assertEqual(result, expected) - # pretty sure 0.0 isn't compatible + # pretty sure 0.0 isn't compatible api_versions = ["0.0"] expected = set() result = _compatible_api_versions(api_versions) diff --git a/test/test_script.py b/test/test_script.py index 405c80d52..fd003710e 100644 --- a/test/test_script.py +++ b/test/test_script.py @@ -134,7 +134,7 @@ class ScriptParserTest(PicardTestCase): self.assertScriptResultEquals("$somefunc()", "x") def test_script_function_decorator_arg(self): - # function with argument + # function with argument @script_function() def somefunc(parser, arg): return arg @@ -161,14 +161,14 @@ class ScriptParserTest(PicardTestCase): self.parser.eval("$somefunc()") def test_script_function_decorator_altprefix(self): - # alternative prefix + # alternative prefix @script_function(prefix='theprefix_') def theprefix_somefunc(parser): return "x" self.assertScriptResultEquals("$somefunc()", "x") def test_script_function_decorator_eval_args(self): - # disable argument evaluation + # disable argument evaluation @script_function(eval_args=False) def somefunc(parser, arg): return arg.eval(parser) @@ -547,7 +547,7 @@ class ScriptParserTest(PicardTestCase): self.assertScriptResultEquals("$title(l'a)", "L'a") self.assertScriptResultEquals("$title(2'a)", "2'A") self.assertScriptResultEquals(r"$title(%empty%)", "") - # Tests wrong number of arguments + # Tests wrong number of arguments areg = r"^\d+:\d+:\$title: Wrong number of arguments for \$title: Expected exactly 1, " with self.assertRaisesRegex(ScriptError, areg): self.parser.eval("$title()") @@ -603,13 +603,13 @@ class ScriptParserTest(PicardTestCase): self.parser.eval("$noargstest()") def test_cmd_with_wrong_argcount_or(self): - # $or() requires at least 2 arguments + # $or() requires at least 2 arguments areg = r"^\d+:\d+:\$or: Wrong number of arguments for \$or: Expected at least 2, " with self.assertRaisesRegex(ScriptError, areg): self.parser.eval('$or(0)') def test_cmd_with_wrong_argcount_eq(self): - # $eq() requires exactly 2 arguments + # $eq() requires exactly 2 arguments areg = r"^\d+:\d+:\$eq: Wrong number of arguments for \$eq: Expected exactly 2, " with self.assertRaisesRegex(ScriptError, areg): self.parser.eval('$eq(0)') @@ -876,7 +876,7 @@ class ScriptParserTest(PicardTestCase): # Tests missing inputs self.assertScriptResultEquals("$find(,c)", "", context) self.assertScriptResultEquals("$find(abcdef,)", "0", context) - # Tests wrong number of arguments + # Tests wrong number of arguments areg = r"^\d+:\d+:\$find: Wrong number of arguments for \$find: Expected exactly 2, " with self.assertRaisesRegex(ScriptError, areg): self.parser.eval("$find(abcdef)")