mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 01:25:47 +01:00
convert: playlist: Add another Windows test
Add test_playlist_write_and_read_unicode_windows: Writes 2 media file paths containing unicode characters, reads them in using M3UFile class again and tests if the contents is correct.
This commit is contained in:
parent
39efd23d06
commit
ff03ecaa27
1 changed files with 26 additions and 0 deletions
|
|
@ -62,6 +62,32 @@ class M3UFileTest(unittest.TestCase):
|
|||
self.assertTrue(path.exists(the_playlist_file))
|
||||
rmtree(tempdir)
|
||||
|
||||
@unittest.skipUnless(sys.platform == 'win32', 'win32')
|
||||
def test_playlist_write_and_read_unicode_windows(self):
|
||||
"""Test saving unicode paths to a playlist file on Windows."""
|
||||
tempdir = bytestring_path(mkdtemp())
|
||||
the_playlist_file = path.join(tempdir,
|
||||
b'playlist_write_and_read_windows.m3u8')
|
||||
m3ufile = M3UFile(the_playlist_file)
|
||||
m3ufile.set_contents([
|
||||
r"x:\This\is\å\path\to_a_file.mp3",
|
||||
r"x:\This\is\another\path\tö_a_file.mp3"
|
||||
])
|
||||
m3ufile.write()
|
||||
self.assertTrue(path.exists(the_playlist_file))
|
||||
m3ufile_read = M3UFile(the_playlist_file)
|
||||
m3ufile_read.load()
|
||||
self.assertEquals(
|
||||
m3ufile.media_list[0],
|
||||
path.join('x:\\', 'This', 'is', 'å', 'path', 'to_a_file.mp3')
|
||||
)
|
||||
self.assertEquals(
|
||||
m3ufile.media_list[1],
|
||||
r"x:\This\is\another\path\tö_a_file.mp3",
|
||||
path.join('x:\\', 'This', 'is', 'another', 'path', 'tö_a_file.mp3')
|
||||
)
|
||||
rmtree(tempdir)
|
||||
|
||||
def test_playlist_load_ascii(self):
|
||||
"""Test loading ascii paths from a playlist file."""
|
||||
the_playlist_file = path.join(RSRC, b'playlist.m3u')
|
||||
|
|
|
|||
Loading…
Reference in a new issue