mirror of
https://github.com/beetbox/beets.git
synced 2025-12-08 09:34:23 +01:00
Removed unicode_literals from test_thumbnails
This commit is contained in:
parent
ccc61a638e
commit
ad073652c2
1 changed files with 11 additions and 12 deletions
|
|
@ -13,8 +13,7 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
import os.path
|
||||
from mock import Mock, patch, call
|
||||
|
|
@ -38,13 +37,13 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
|
||||
@patch('beetsplug.thumbnails.util')
|
||||
def test_write_metadata_im(self, mock_util):
|
||||
metadata = {"a": "A", "b": "B"}
|
||||
metadata = {"a": u"A", "b": u"B"}
|
||||
write_metadata_im("foo", metadata)
|
||||
try:
|
||||
command = "convert foo -set a A -set b B foo".split(' ')
|
||||
command = u"convert foo -set a A -set b B foo".split(' ')
|
||||
mock_util.command_output.assert_called_once_with(command)
|
||||
except AssertionError:
|
||||
command = "convert foo -set b B -set a A foo".split(' ')
|
||||
command = u"convert foo -set b B -set a A foo".split(' ')
|
||||
mock_util.command_output.assert_called_once_with(command)
|
||||
|
||||
@patch('beetsplug.thumbnails.ThumbnailsPlugin._check_local_ok')
|
||||
|
|
@ -60,7 +59,7 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
plugin.add_tags(album, b"/path/to/thumbnail")
|
||||
|
||||
metadata = {"Thumb::URI": b"COVER_URI",
|
||||
"Thumb::MTime": "12345"}
|
||||
"Thumb::MTime": u"12345"}
|
||||
plugin.write_metadata.assert_called_once_with(b"/path/to/thumbnail",
|
||||
metadata)
|
||||
mock_stat.assert_called_once_with(album.artpath)
|
||||
|
|
@ -85,7 +84,7 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
return False
|
||||
if path == LARGE_DIR:
|
||||
return True
|
||||
raise ValueError("unexpected path {0!r}".format(path))
|
||||
raise ValueError(u"unexpected path {0!r}".format(path))
|
||||
mock_os.path.exists = exists
|
||||
plugin = ThumbnailsPlugin()
|
||||
mock_os.makedirs.assert_called_once_with(NORMAL_DIR)
|
||||
|
|
@ -143,7 +142,7 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
elif target == path_to_art:
|
||||
return Mock(st_mtime=2)
|
||||
else:
|
||||
raise ValueError("invalid target {0}".format(target))
|
||||
raise ValueError(u"invalid target {0}".format(target))
|
||||
mock_os.stat.side_effect = os_stat
|
||||
|
||||
plugin.make_cover_thumbnail(album, 12345, thumbnail_dir)
|
||||
|
|
@ -169,7 +168,7 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
elif target == path_to_art:
|
||||
return Mock(st_mtime=2)
|
||||
else:
|
||||
raise ValueError("invalid target {0}".format(target))
|
||||
raise ValueError(u"invalid target {0}".format(target))
|
||||
mock_os.stat.side_effect = os_stat
|
||||
|
||||
plugin.make_cover_thumbnail(album, 12345, thumbnail_dir)
|
||||
|
|
@ -266,7 +265,7 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
@patch('beetsplug.thumbnails.BaseDirectory')
|
||||
def test_thumbnail_file_name(self, mock_basedir):
|
||||
plug = ThumbnailsPlugin()
|
||||
plug.get_uri = Mock(return_value="file:///my/uri")
|
||||
plug.get_uri = Mock(return_value=u"file:///my/uri")
|
||||
self.assertEqual(plug.thumbnail_file_name("idontcare"),
|
||||
b"9488f5797fbe12ffb316d607dfd93d04.png")
|
||||
|
||||
|
|
@ -274,9 +273,9 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
gio = GioURI()
|
||||
plib = PathlibURI()
|
||||
if not gio.available:
|
||||
self.skipTest("GIO library not found")
|
||||
self.skipTest(u"GIO library not found")
|
||||
|
||||
self.assertEqual(gio.uri("/foo"), b"file:///") # silent fail
|
||||
self.assertEqual(gio.uri(u"/foo"), b"file:///") # silent fail
|
||||
self.assertEqual(gio.uri(b"/foo"), b"file:///foo")
|
||||
self.assertEqual(gio.uri(b"/foo!"), b"file:///foo!")
|
||||
self.assertEqual(plib.uri(b"/foo!"), b"file:///foo%21")
|
||||
|
|
|
|||
Loading…
Reference in a new issue