本文整理汇总了Python中beetsplug.thumbnails.ThumbnailsPlugin.config["dolphin"]方法的典型用法代码示例。如果您正苦于以下问题:Python ThumbnailsPlugin.config["dolphin"]方法的具体用法?Python ThumbnailsPlugin.config["dolphin"]怎么用?Python ThumbnailsPlugin.config["dolphin"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类beetsplug.thumbnails.ThumbnailsPlugin
的用法示例。
在下文中一共展示了ThumbnailsPlugin.config["dolphin"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_process_album
# 需要导入模块: from beetsplug.thumbnails import ThumbnailsPlugin [as 别名]
# 或者: from beetsplug.thumbnails.ThumbnailsPlugin import config["dolphin"] [as 别名]
def test_process_album(self, mock_artresizer, _):
get_size = mock_artresizer.shared.get_size
plugin = ThumbnailsPlugin()
make_cover = plugin.make_cover_thumbnail = Mock(return_value=True)
make_dolphin = plugin.make_dolphin_cover_thumbnail = Mock()
# no art
album = Mock(artpath=None)
plugin.process_album(album)
self.assertEqual(get_size.call_count, 0)
self.assertEqual(make_dolphin.call_count, 0)
# cannot get art size
album.artpath = b"/path/to/art"
get_size.return_value = None
plugin.process_album(album)
get_size.assert_called_once_with(b"/path/to/art")
self.assertEqual(make_cover.call_count, 0)
# dolphin tests
plugin.config["dolphin"] = False
plugin.process_album(album)
self.assertEqual(make_dolphin.call_count, 0)
plugin.config["dolphin"] = True
plugin.process_album(album)
make_dolphin.assert_called_once_with(album)
# small art
get_size.return_value = 200, 200
plugin.process_album(album)
make_cover.assert_called_once_with(album, 128, NORMAL_DIR)
# big art
make_cover.reset_mock()
get_size.return_value = 500, 500
plugin.process_album(album)
make_cover.has_calls([call(album, 128, NORMAL_DIR), call(album, 256, LARGE_DIR)], any_order=True)