Skip to content

Commit

Permalink
satisfy the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Blank committed Apr 11, 2024
1 parent ada2f80 commit 6a27a8d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
8 changes: 4 additions & 4 deletions beetsplug/fetchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ def _validate(self, plugin, skip_check_for=None):
plugin.cover_format,
)

if downscale and (not self.CANDIDATE_DOWNSCALE in skip_check_for):
if downscale and (self.CANDIDATE_DOWNSCALE not in skip_check_for):
return self.CANDIDATE_DOWNSCALE
if reformat and (not self.CANDIDATE_REFORMAT in skip_check_for):
if reformat and (self.CANDIDATE_REFORMAT not in skip_check_for):
return self.CANDIDATE_REFORMAT
if plugin.deinterlace and (
not self.CANDIDATE_DEINTERLACE in skip_check_for
self.CANDIDATE_DEINTERLACE not in skip_check_for
):
return self.CANDIDATE_DEINTERLACE
if downsize and (not self.CANDIDATE_DOWNSIZE in skip_check_for):
if downsize and (self.CANDIDATE_DOWNSIZE not in skip_check_for):
return self.CANDIDATE_DOWNSIZE
return self.CANDIDATE_EXACT

Expand Down
24 changes: 13 additions & 11 deletions test/plugins/test_art.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ def _assertImageIsValidArt(self, image_file, should_exist): # noqa
else:
self.assertIsNone(candidate)

def _assertImageOperated(
def _assert_image_operated(
self, image_file, operation, should_operate
): # noqa
self.image_file = image_file
Expand Down Expand Up @@ -954,45 +954,47 @@ def test_respect_enforce_ratio_percent_below(self):
def test_resize_if_necessary(self):
self._require_backend()
self.plugin.maxwidth = 300
self._assertImageOperated(self.IMG_225x225, self.RESIZE_OP, False)
self._assertImageOperated(self.IMG_348x348, self.RESIZE_OP, True)
self._assert_image_operated(self.IMG_225x225, self.RESIZE_OP, False)
self._assert_image_operated(self.IMG_348x348, self.RESIZE_OP, True)

def test_fileresize(self):
self._require_backend()
self.plugin.max_filesize = self.IMG_225x225_SIZE // 2
self._assertImageOperated(self.IMG_225x225, self.RESIZE_OP, True)
self._assert_image_operated(self.IMG_225x225, self.RESIZE_OP, True)

def test_fileresize_if_necessary(self):
self._require_backend()
self.plugin.max_filesize = self.IMG_225x225_SIZE
self._assertImageOperated(self.IMG_225x225, self.RESIZE_OP, False)
self._assert_image_operated(self.IMG_225x225, self.RESIZE_OP, False)
self._assertImageIsValidArt(self.IMG_225x225, True)

def test_fileresize_no_scale(self):
self._require_backend()
self.plugin.maxwidth = 300
self.plugin.max_filesize = self.IMG_225x225_SIZE // 2
self._assertImageOperated(self.IMG_225x225, self.RESIZE_OP, True)
self._assert_image_operated(self.IMG_225x225, self.RESIZE_OP, True)

def test_fileresize_and_scale(self):
self._require_backend()
self.plugin.maxwidth = 200
self.plugin.max_filesize = self.IMG_225x225_SIZE // 2
self._assertImageOperated(self.IMG_225x225, self.RESIZE_OP, True)
self._assert_image_operated(self.IMG_225x225, self.RESIZE_OP, True)

def test_deinterlace(self):
self._require_backend()
self.plugin.deinterlace = True
self._assertImageOperated(self.IMG_225x225, self.DEINTERLACE_OP, True)
self._assert_image_operated(self.IMG_225x225, self.DEINTERLACE_OP, True)
self.plugin.deinterlace = False
self._assertImageOperated(self.IMG_225x225, self.DEINTERLACE_OP, False)
self._assert_image_operated(
self.IMG_225x225, self.DEINTERLACE_OP, False
)

def test_deinterlace_and_resize(self):
self._require_backend()
self.plugin.maxwidth = 300
self.plugin.deinterlace = True
self._assertImageOperated(self.IMG_348x348, self.DEINTERLACE_OP, True)
self._assertImageOperated(self.IMG_348x348, self.RESIZE_OP, True)
self._assert_image_operated(self.IMG_348x348, self.DEINTERLACE_OP, True)
self._assert_image_operated(self.IMG_348x348, self.RESIZE_OP, True)


class DeprecatedConfigTest(_common.TestCase):
Expand Down

0 comments on commit 6a27a8d

Please sign in to comment.