mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-25 17:13:57 +00:00
@@ -9,6 +9,7 @@ import unittest
|
||||
from picard.i18n import setup_gettext
|
||||
from picard.util import bytes2human
|
||||
|
||||
|
||||
class Testbytes2human(unittest.TestCase):
|
||||
def setUp(self):
|
||||
# we are using temporary locales for tests
|
||||
@@ -41,7 +42,7 @@ class Testbytes2human(unittest.TestCase):
|
||||
except Exception as e:
|
||||
self.fail('Unexpected exception: %s' % e)
|
||||
|
||||
def run_test(self, lang = 'C', create_test_data=False):
|
||||
def run_test(self, lang='C', create_test_data=False):
|
||||
"""
|
||||
Compare data generated with sample files
|
||||
Setting create_test_data to True will generated sample files
|
||||
@@ -62,10 +63,10 @@ class Testbytes2human(unittest.TestCase):
|
||||
values = [0, 1]
|
||||
for n in [1000, 1024]:
|
||||
p = 1
|
||||
for e in range(0,6):
|
||||
for e in range(0, 6):
|
||||
p *= n
|
||||
for x in [0.1, 0.5, 0.99, 0.9999, 1, 1.5]:
|
||||
values.append(int(p*x))
|
||||
values.append(int(p * x))
|
||||
l = []
|
||||
for x in sorted(values):
|
||||
l.append(";".join([str(x), bytes2human.decimal(x),
|
||||
|
||||
@@ -4,11 +4,12 @@ import unittest
|
||||
from mutagen import id3
|
||||
from picard.formats.mutagenext import compatid3
|
||||
|
||||
|
||||
class UpdateToV23Test(unittest.TestCase):
|
||||
|
||||
def test_multiple_text_values(self):
|
||||
tags = compatid3.CompatID3()
|
||||
tags.add(id3.TALB(encoding=0, text=["123","abc"]))
|
||||
tags.add(id3.TALB(encoding=0, text=["123", "abc"]))
|
||||
tags.update_to_v23()
|
||||
self.assertEqual(tags["TALB"].text, ["123/abc"])
|
||||
|
||||
@@ -36,7 +37,7 @@ class UpdateToV23Test(unittest.TestCase):
|
||||
|
||||
def test_genre_from_v24_1(self):
|
||||
tags = compatid3.CompatID3()
|
||||
tags.add(id3.TCON(encoding=1, text=["4","Rock"]))
|
||||
tags.add(id3.TCON(encoding=1, text=["4", "Rock"]))
|
||||
tags.update_to_v23()
|
||||
self.assertEqual(tags["TCON"].text, ["Disco/Rock"])
|
||||
|
||||
@@ -57,4 +58,3 @@ class UpdateToV23Test(unittest.TestCase):
|
||||
tags.add(id3.TCON(encoding=1, text=["(RX)(3)(CR)"]))
|
||||
tags.update_to_v23()
|
||||
self.assertEqual(tags["TCON"].text, ["Remix/Dance/Cover"])
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ class FakeTagger(QtCore.QObject):
|
||||
QtCore.QObject.log = log
|
||||
self.tagger_stats_changed.connect(self.emit)
|
||||
|
||||
|
||||
def emit(self, *args):
|
||||
pass
|
||||
|
||||
@@ -96,404 +95,404 @@ class FLACTest(FormatsTest):
|
||||
original = os.path.join('test', 'data', 'test.flac')
|
||||
supports_ratings = True
|
||||
tags = {
|
||||
'album' : 'Foo Bar',
|
||||
'album' : '1',
|
||||
'title' : 'Foo',
|
||||
'artist' : 'Foo',
|
||||
'albumartist' : 'Foo',
|
||||
'date' : '2004',
|
||||
'originaldate' : '1980',
|
||||
'artist' : 'Foo',
|
||||
'composer' : 'Foo',
|
||||
'lyricist' : 'Foo',
|
||||
'conductor' : 'Foo',
|
||||
'performer:guest vocal' : 'Foo',
|
||||
'remixer' : 'Foo',
|
||||
'arranger' : 'Foo',
|
||||
'engineer' : 'Foo',
|
||||
'producer' : 'Foo',
|
||||
'djmixer' : 'Foo',
|
||||
'mixer' : 'Foo',
|
||||
'grouping' : 'Foo',
|
||||
'subtitle' : 'Foo',
|
||||
'discsubtitle' : 'Foo',
|
||||
'tracknumber' : '2',
|
||||
'totaltracks' : '10',
|
||||
'discnumber' : '1',
|
||||
'totaldiscs' : '2',
|
||||
'compilation' : '1',
|
||||
'comment:' : 'Foo',
|
||||
'comment:foo' : 'Foo',
|
||||
'genre' : 'Foo',
|
||||
'bpm' : '80',
|
||||
'mood' : 'Foo',
|
||||
'isrc' : 'Foo',
|
||||
'copyright' : 'Foo',
|
||||
'lyrics' : 'Foo',
|
||||
'media' : 'Foo',
|
||||
'label' : 'Foo',
|
||||
'catalognumber' : 'Foo',
|
||||
'barcode' : 'Foo',
|
||||
'encodedby' : 'Foo',
|
||||
'albumsort' : 'Foo',
|
||||
'albumartistsort' : 'Foo',
|
||||
'artistsort' : 'Foo',
|
||||
'titlesort' : 'Foo',
|
||||
#'composersort' : 'Foo',
|
||||
#'showsort' : 'Foo',
|
||||
'musicbrainz_trackid' : 'Foo',
|
||||
'musicbrainz_albumid' : 'Foo',
|
||||
'musicbrainz_artistid' : 'Foo',
|
||||
'musicbrainz_albumartistid' : 'Foo',
|
||||
'musicbrainz_trmid' : 'Foo',
|
||||
'musicbrainz_discid' : 'Foo',
|
||||
'musicip_puid' : 'Foo',
|
||||
'musicip_fingerprint' : 'Foo',
|
||||
'releasestatus' : 'Foo',
|
||||
'releasetype' : 'Foo',
|
||||
'asin' : 'Foo',
|
||||
#'gapless' : '1',
|
||||
#'podcast' : '1',
|
||||
#'podcasturl' : 'Foo',
|
||||
#'show' : 'Foo',
|
||||
}
|
||||
'album': 'Foo Bar',
|
||||
'album': '1',
|
||||
'title': 'Foo',
|
||||
'artist': 'Foo',
|
||||
'albumartist': 'Foo',
|
||||
'date': '2004',
|
||||
'originaldate': '1980',
|
||||
'artist': 'Foo',
|
||||
'composer': 'Foo',
|
||||
'lyricist': 'Foo',
|
||||
'conductor': 'Foo',
|
||||
'performer:guest vocal': 'Foo',
|
||||
'remixer': 'Foo',
|
||||
'arranger': 'Foo',
|
||||
'engineer': 'Foo',
|
||||
'producer': 'Foo',
|
||||
'djmixer': 'Foo',
|
||||
'mixer': 'Foo',
|
||||
'grouping': 'Foo',
|
||||
'subtitle': 'Foo',
|
||||
'discsubtitle': 'Foo',
|
||||
'tracknumber': '2',
|
||||
'totaltracks': '10',
|
||||
'discnumber': '1',
|
||||
'totaldiscs': '2',
|
||||
'compilation': '1',
|
||||
'comment:': 'Foo',
|
||||
'comment:foo': 'Foo',
|
||||
'genre': 'Foo',
|
||||
'bpm': '80',
|
||||
'mood': 'Foo',
|
||||
'isrc': 'Foo',
|
||||
'copyright': 'Foo',
|
||||
'lyrics': 'Foo',
|
||||
'media': 'Foo',
|
||||
'label': 'Foo',
|
||||
'catalognumber': 'Foo',
|
||||
'barcode': 'Foo',
|
||||
'encodedby': 'Foo',
|
||||
'albumsort': 'Foo',
|
||||
'albumartistsort': 'Foo',
|
||||
'artistsort': 'Foo',
|
||||
'titlesort': 'Foo',
|
||||
#'composersort': 'Foo',
|
||||
#'showsort': 'Foo',
|
||||
'musicbrainz_trackid': 'Foo',
|
||||
'musicbrainz_albumid': 'Foo',
|
||||
'musicbrainz_artistid': 'Foo',
|
||||
'musicbrainz_albumartistid': 'Foo',
|
||||
'musicbrainz_trmid': 'Foo',
|
||||
'musicbrainz_discid': 'Foo',
|
||||
'musicip_puid': 'Foo',
|
||||
'musicip_fingerprint': 'Foo',
|
||||
'releasestatus': 'Foo',
|
||||
'releasetype': 'Foo',
|
||||
'asin': 'Foo',
|
||||
#'gapless': '1',
|
||||
#'podcast': '1',
|
||||
#'podcasturl': 'Foo',
|
||||
#'show': 'Foo',
|
||||
}
|
||||
|
||||
|
||||
class WMATest(FormatsTest):
|
||||
original = os.path.join('test', 'data', 'test.wma')
|
||||
supports_ratings = True
|
||||
tags = {
|
||||
'album' : 'Foo Bar',
|
||||
'album' : '1',
|
||||
'title' : 'Foo',
|
||||
'artist' : 'Foo',
|
||||
'albumartist' : 'Foo',
|
||||
'date' : '2004',
|
||||
'originaldate' : '1980',
|
||||
'artist' : 'Foo',
|
||||
'composer' : 'Foo',
|
||||
'lyricist' : 'Foo',
|
||||
'conductor' : 'Foo',
|
||||
#'performer:guest vocal' : 'Foo',
|
||||
'remixer' : 'Foo',
|
||||
#'arranger' : 'Foo',
|
||||
#'engineer' : 'Foo',
|
||||
'producer' : 'Foo',
|
||||
#'djmixer' : 'Foo',
|
||||
#'mixer' : 'Foo',
|
||||
'grouping' : 'Foo',
|
||||
'subtitle' : 'Foo',
|
||||
'discsubtitle' : 'Foo',
|
||||
'tracknumber' : '2',
|
||||
#'totaltracks' : '10',
|
||||
'discnumber' : '1',
|
||||
#'totaldiscs' : '2',
|
||||
#'compilation' : '1',
|
||||
'comment:' : 'Foo',
|
||||
'album': 'Foo Bar',
|
||||
'album': '1',
|
||||
'title': 'Foo',
|
||||
'artist': 'Foo',
|
||||
'albumartist': 'Foo',
|
||||
'date': '2004',
|
||||
'originaldate': '1980',
|
||||
'artist': 'Foo',
|
||||
'composer': 'Foo',
|
||||
'lyricist': 'Foo',
|
||||
'conductor': 'Foo',
|
||||
#'performer:guest vocal': 'Foo',
|
||||
'remixer': 'Foo',
|
||||
#'arranger': 'Foo',
|
||||
#'engineer': 'Foo',
|
||||
'producer': 'Foo',
|
||||
#'djmixer': 'Foo',
|
||||
#'mixer': 'Foo',
|
||||
'grouping': 'Foo',
|
||||
'subtitle': 'Foo',
|
||||
'discsubtitle': 'Foo',
|
||||
'tracknumber': '2',
|
||||
#'totaltracks': '10',
|
||||
'discnumber': '1',
|
||||
#'totaldiscs': '2',
|
||||
#'compilation': '1',
|
||||
'comment:': 'Foo',
|
||||
# FIXME: comment:foo is unsupported in our WMA implementation
|
||||
#'comment:foo' : 'Foo',
|
||||
'genre' : 'Foo',
|
||||
'bpm' : '80',
|
||||
'mood' : 'Foo',
|
||||
'isrc' : 'Foo',
|
||||
'copyright' : 'Foo',
|
||||
'lyrics' : 'Foo',
|
||||
#'media' : 'Foo',
|
||||
'label' : 'Foo',
|
||||
#'catalognumber' : 'Foo',
|
||||
#'barcode' : 'Foo',
|
||||
'encodedby' : 'Foo',
|
||||
'albumsort' : 'Foo',
|
||||
'albumartistsort' : 'Foo',
|
||||
'artistsort' : 'Foo',
|
||||
'titlesort' : 'Foo',
|
||||
#'composersort' : 'Foo',
|
||||
#'showsort' : 'Foo',
|
||||
'musicbrainz_trackid' : 'Foo',
|
||||
'musicbrainz_albumid' : 'Foo',
|
||||
'musicbrainz_artistid' : 'Foo',
|
||||
'musicbrainz_albumartistid' : 'Foo',
|
||||
'musicbrainz_trmid' : 'Foo',
|
||||
'musicbrainz_discid' : 'Foo',
|
||||
'musicip_puid' : 'Foo',
|
||||
#'musicip_fingerprint' : 'Foo',
|
||||
'releasestatus' : 'Foo',
|
||||
'releasetype' : 'Foo',
|
||||
#'asin' : 'Foo',
|
||||
#'gapless' : '1',
|
||||
#'podcast' : '1',
|
||||
#'podcasturl' : 'Foo',
|
||||
#'show' : 'Foo',
|
||||
}
|
||||
#'comment:foo': 'Foo',
|
||||
'genre': 'Foo',
|
||||
'bpm': '80',
|
||||
'mood': 'Foo',
|
||||
'isrc': 'Foo',
|
||||
'copyright': 'Foo',
|
||||
'lyrics': 'Foo',
|
||||
#'media': 'Foo',
|
||||
'label': 'Foo',
|
||||
#'catalognumber': 'Foo',
|
||||
#'barcode': 'Foo',
|
||||
'encodedby': 'Foo',
|
||||
'albumsort': 'Foo',
|
||||
'albumartistsort': 'Foo',
|
||||
'artistsort': 'Foo',
|
||||
'titlesort': 'Foo',
|
||||
#'composersort': 'Foo',
|
||||
#'showsort': 'Foo',
|
||||
'musicbrainz_trackid': 'Foo',
|
||||
'musicbrainz_albumid': 'Foo',
|
||||
'musicbrainz_artistid': 'Foo',
|
||||
'musicbrainz_albumartistid': 'Foo',
|
||||
'musicbrainz_trmid': 'Foo',
|
||||
'musicbrainz_discid': 'Foo',
|
||||
'musicip_puid': 'Foo',
|
||||
#'musicip_fingerprint': 'Foo',
|
||||
'releasestatus': 'Foo',
|
||||
'releasetype': 'Foo',
|
||||
#'asin': 'Foo',
|
||||
#'gapless': '1',
|
||||
#'podcast': '1',
|
||||
#'podcasturl': 'Foo',
|
||||
#'show': 'Foo',
|
||||
}
|
||||
|
||||
|
||||
class MP3Test(FormatsTest):
|
||||
original = os.path.join('test', 'data', 'test.mp3')
|
||||
supports_ratings = True
|
||||
tags = {
|
||||
'album' : 'Foo Bar',
|
||||
'album' : '1',
|
||||
'title' : 'Foo',
|
||||
'artist' : 'Foo',
|
||||
'albumartist' : 'Foo',
|
||||
'date' : '2004',
|
||||
'originaldate' : '1980',
|
||||
'artist' : 'Foo',
|
||||
'composer' : 'Foo',
|
||||
'lyricist' : 'Foo',
|
||||
'conductor' : 'Foo',
|
||||
'performer:guest vocal' : 'Foo',
|
||||
'remixer' : 'Foo',
|
||||
'arranger' : 'Foo',
|
||||
'engineer' : 'Foo',
|
||||
'producer' : 'Foo',
|
||||
'djmixer' : 'Foo',
|
||||
'mixer' : 'Foo',
|
||||
'grouping' : 'Foo',
|
||||
'subtitle' : 'Foo',
|
||||
'discsubtitle' : 'Foo',
|
||||
'tracknumber' : '2',
|
||||
'totaltracks' : '10',
|
||||
'discnumber' : '1',
|
||||
'totaldiscs' : '2',
|
||||
'compilation' : '1',
|
||||
'comment:' : 'Foo',
|
||||
'comment:foo' : 'Foo',
|
||||
'genre' : 'Foo',
|
||||
'bpm' : '80',
|
||||
'mood' : 'Foo',
|
||||
'isrc' : 'Foo',
|
||||
'copyright' : 'Foo',
|
||||
'lyrics' : 'Foo',
|
||||
'media' : 'Foo',
|
||||
'label' : 'Foo',
|
||||
'catalognumber' : 'Foo',
|
||||
'barcode' : 'Foo',
|
||||
'encodedby' : 'Foo',
|
||||
'albumsort' : 'Foo',
|
||||
'albumartistsort' : 'Foo',
|
||||
'artistsort' : 'Foo',
|
||||
'titlesort' : 'Foo',
|
||||
#'composersort' : 'Foo',
|
||||
#'showsort' : 'Foo',
|
||||
'musicbrainz_trackid' : 'Foo',
|
||||
'musicbrainz_albumid' : 'Foo',
|
||||
'musicbrainz_artistid' : 'Foo',
|
||||
'musicbrainz_albumartistid' : 'Foo',
|
||||
'musicbrainz_trmid' : 'Foo',
|
||||
'musicbrainz_discid' : 'Foo',
|
||||
'musicip_puid' : 'Foo',
|
||||
'musicip_fingerprint' : 'Foo',
|
||||
'releasestatus' : 'Foo',
|
||||
'releasetype' : 'Foo',
|
||||
'asin' : 'Foo',
|
||||
#'gapless' : '1',
|
||||
#'podcast' : '1',
|
||||
#'podcasturl' : 'Foo',
|
||||
#'show' : 'Foo',
|
||||
}
|
||||
'album': 'Foo Bar',
|
||||
'album': '1',
|
||||
'title': 'Foo',
|
||||
'artist': 'Foo',
|
||||
'albumartist': 'Foo',
|
||||
'date': '2004',
|
||||
'originaldate': '1980',
|
||||
'artist': 'Foo',
|
||||
'composer': 'Foo',
|
||||
'lyricist': 'Foo',
|
||||
'conductor': 'Foo',
|
||||
'performer:guest vocal': 'Foo',
|
||||
'remixer': 'Foo',
|
||||
'arranger': 'Foo',
|
||||
'engineer': 'Foo',
|
||||
'producer': 'Foo',
|
||||
'djmixer': 'Foo',
|
||||
'mixer': 'Foo',
|
||||
'grouping': 'Foo',
|
||||
'subtitle': 'Foo',
|
||||
'discsubtitle': 'Foo',
|
||||
'tracknumber': '2',
|
||||
'totaltracks': '10',
|
||||
'discnumber': '1',
|
||||
'totaldiscs': '2',
|
||||
'compilation': '1',
|
||||
'comment:': 'Foo',
|
||||
'comment:foo': 'Foo',
|
||||
'genre': 'Foo',
|
||||
'bpm': '80',
|
||||
'mood': 'Foo',
|
||||
'isrc': 'Foo',
|
||||
'copyright': 'Foo',
|
||||
'lyrics': 'Foo',
|
||||
'media': 'Foo',
|
||||
'label': 'Foo',
|
||||
'catalognumber': 'Foo',
|
||||
'barcode': 'Foo',
|
||||
'encodedby': 'Foo',
|
||||
'albumsort': 'Foo',
|
||||
'albumartistsort': 'Foo',
|
||||
'artistsort': 'Foo',
|
||||
'titlesort': 'Foo',
|
||||
#'composersort': 'Foo',
|
||||
#'showsort': 'Foo',
|
||||
'musicbrainz_trackid': 'Foo',
|
||||
'musicbrainz_albumid': 'Foo',
|
||||
'musicbrainz_artistid': 'Foo',
|
||||
'musicbrainz_albumartistid': 'Foo',
|
||||
'musicbrainz_trmid': 'Foo',
|
||||
'musicbrainz_discid': 'Foo',
|
||||
'musicip_puid': 'Foo',
|
||||
'musicip_fingerprint': 'Foo',
|
||||
'releasestatus': 'Foo',
|
||||
'releasetype': 'Foo',
|
||||
'asin': 'Foo',
|
||||
#'gapless': '1',
|
||||
#'podcast': '1',
|
||||
#'podcasturl': 'Foo',
|
||||
#'show': 'Foo',
|
||||
}
|
||||
|
||||
|
||||
class OggVorbisTest(FormatsTest):
|
||||
original = os.path.join('test', 'data', 'test.ogg')
|
||||
supports_ratings = True
|
||||
tags = {
|
||||
'album' : 'Foo Bar',
|
||||
'album' : '1',
|
||||
'title' : 'Foo',
|
||||
'artist' : 'Foo',
|
||||
'albumartist' : 'Foo',
|
||||
'date' : '2004',
|
||||
'originaldate' : '1980',
|
||||
'artist' : 'Foo',
|
||||
'composer' : 'Foo',
|
||||
'lyricist' : 'Foo',
|
||||
'conductor' : 'Foo',
|
||||
'performer:guest vocal' : 'Foo',
|
||||
'remixer' : 'Foo',
|
||||
'arranger' : 'Foo',
|
||||
'engineer' : 'Foo',
|
||||
'producer' : 'Foo',
|
||||
'djmixer' : 'Foo',
|
||||
'mixer' : 'Foo',
|
||||
'grouping' : 'Foo',
|
||||
'subtitle' : 'Foo',
|
||||
'discsubtitle' : 'Foo',
|
||||
'tracknumber' : '2',
|
||||
'totaltracks' : '10',
|
||||
'discnumber' : '1',
|
||||
'totaldiscs' : '2',
|
||||
'compilation' : '1',
|
||||
'comment:' : 'Foo',
|
||||
'comment:foo' : 'Foo',
|
||||
'genre' : 'Foo',
|
||||
'bpm' : '80',
|
||||
'mood' : 'Foo',
|
||||
'isrc' : 'Foo',
|
||||
'copyright' : 'Foo',
|
||||
'lyrics' : 'Foo',
|
||||
'media' : 'Foo',
|
||||
'label' : 'Foo',
|
||||
'catalognumber' : 'Foo',
|
||||
'barcode' : 'Foo',
|
||||
'encodedby' : 'Foo',
|
||||
'albumsort' : 'Foo',
|
||||
'albumartistsort' : 'Foo',
|
||||
'artistsort' : 'Foo',
|
||||
'titlesort' : 'Foo',
|
||||
#'composersort' : 'Foo',
|
||||
#'showsort' : 'Foo',
|
||||
'musicbrainz_trackid' : 'Foo',
|
||||
'musicbrainz_albumid' : 'Foo',
|
||||
'musicbrainz_artistid' : 'Foo',
|
||||
'musicbrainz_albumartistid' : 'Foo',
|
||||
'musicbrainz_trmid' : 'Foo',
|
||||
'musicbrainz_discid' : 'Foo',
|
||||
'musicip_puid' : 'Foo',
|
||||
'musicip_fingerprint' : 'Foo',
|
||||
'releasestatus' : 'Foo',
|
||||
'releasetype' : 'Foo',
|
||||
'asin' : 'Foo',
|
||||
#'gapless' : '1',
|
||||
#'podcast' : '1',
|
||||
#'podcasturl' : 'Foo',
|
||||
#'show' : 'Foo',
|
||||
}
|
||||
'album': 'Foo Bar',
|
||||
'album': '1',
|
||||
'title': 'Foo',
|
||||
'artist': 'Foo',
|
||||
'albumartist': 'Foo',
|
||||
'date': '2004',
|
||||
'originaldate': '1980',
|
||||
'artist': 'Foo',
|
||||
'composer': 'Foo',
|
||||
'lyricist': 'Foo',
|
||||
'conductor': 'Foo',
|
||||
'performer:guest vocal': 'Foo',
|
||||
'remixer': 'Foo',
|
||||
'arranger': 'Foo',
|
||||
'engineer': 'Foo',
|
||||
'producer': 'Foo',
|
||||
'djmixer': 'Foo',
|
||||
'mixer': 'Foo',
|
||||
'grouping': 'Foo',
|
||||
'subtitle': 'Foo',
|
||||
'discsubtitle': 'Foo',
|
||||
'tracknumber': '2',
|
||||
'totaltracks': '10',
|
||||
'discnumber': '1',
|
||||
'totaldiscs': '2',
|
||||
'compilation': '1',
|
||||
'comment:': 'Foo',
|
||||
'comment:foo': 'Foo',
|
||||
'genre': 'Foo',
|
||||
'bpm': '80',
|
||||
'mood': 'Foo',
|
||||
'isrc': 'Foo',
|
||||
'copyright': 'Foo',
|
||||
'lyrics': 'Foo',
|
||||
'media': 'Foo',
|
||||
'label': 'Foo',
|
||||
'catalognumber': 'Foo',
|
||||
'barcode': 'Foo',
|
||||
'encodedby': 'Foo',
|
||||
'albumsort': 'Foo',
|
||||
'albumartistsort': 'Foo',
|
||||
'artistsort': 'Foo',
|
||||
'titlesort': 'Foo',
|
||||
#'composersort': 'Foo',
|
||||
#'showsort': 'Foo',
|
||||
'musicbrainz_trackid': 'Foo',
|
||||
'musicbrainz_albumid': 'Foo',
|
||||
'musicbrainz_artistid': 'Foo',
|
||||
'musicbrainz_albumartistid': 'Foo',
|
||||
'musicbrainz_trmid': 'Foo',
|
||||
'musicbrainz_discid': 'Foo',
|
||||
'musicip_puid': 'Foo',
|
||||
'musicip_fingerprint': 'Foo',
|
||||
'releasestatus': 'Foo',
|
||||
'releasetype': 'Foo',
|
||||
'asin': 'Foo',
|
||||
#'gapless': '1',
|
||||
#'podcast': '1',
|
||||
#'podcasturl': 'Foo',
|
||||
#'show': 'Foo',
|
||||
}
|
||||
|
||||
|
||||
class MP4Test(FormatsTest):
|
||||
original = os.path.join('test', 'data', 'test.m4a')
|
||||
supports_ratings = False
|
||||
tags = {
|
||||
'album' : 'Foo Bar',
|
||||
'album' : '1',
|
||||
'title' : 'Foo',
|
||||
'artist' : 'Foo',
|
||||
'albumartist' : 'Foo',
|
||||
'date' : '2004',
|
||||
#'originaldate' : '1980',
|
||||
'artist' : 'Foo',
|
||||
'composer' : 'Foo',
|
||||
'lyricist' : 'Foo',
|
||||
'conductor' : 'Foo',
|
||||
#'performer:guest vocal' : 'Foo',
|
||||
'remixer' : 'Foo',
|
||||
#'arranger' : 'Foo',
|
||||
'engineer' : 'Foo',
|
||||
'producer' : 'Foo',
|
||||
'djmixer' : 'Foo',
|
||||
'mixer' : 'Foo',
|
||||
'grouping' : 'Foo',
|
||||
'subtitle' : 'Foo',
|
||||
'discsubtitle' : 'Foo',
|
||||
'tracknumber' : '2',
|
||||
'totaltracks' : '10',
|
||||
'discnumber' : '1',
|
||||
'totaldiscs' : '2',
|
||||
'compilation' : '1',
|
||||
'comment:' : 'Foo',
|
||||
'album': 'Foo Bar',
|
||||
'album': '1',
|
||||
'title': 'Foo',
|
||||
'artist': 'Foo',
|
||||
'albumartist': 'Foo',
|
||||
'date': '2004',
|
||||
#'originaldate': '1980',
|
||||
'artist': 'Foo',
|
||||
'composer': 'Foo',
|
||||
'lyricist': 'Foo',
|
||||
'conductor': 'Foo',
|
||||
#'performer:guest vocal': 'Foo',
|
||||
'remixer': 'Foo',
|
||||
#'arranger': 'Foo',
|
||||
'engineer': 'Foo',
|
||||
'producer': 'Foo',
|
||||
'djmixer': 'Foo',
|
||||
'mixer': 'Foo',
|
||||
'grouping': 'Foo',
|
||||
'subtitle': 'Foo',
|
||||
'discsubtitle': 'Foo',
|
||||
'tracknumber': '2',
|
||||
'totaltracks': '10',
|
||||
'discnumber': '1',
|
||||
'totaldiscs': '2',
|
||||
'compilation': '1',
|
||||
'comment:': 'Foo',
|
||||
# FIXME: comment:foo is unsupported in our MP4 implementation
|
||||
#'comment:foo' : 'Foo',
|
||||
'genre' : 'Foo',
|
||||
'bpm' : '80',
|
||||
'mood' : 'Foo',
|
||||
'isrc' : 'Foo',
|
||||
'copyright' : 'Foo',
|
||||
'lyrics' : 'Foo',
|
||||
'media' : 'Foo',
|
||||
'label' : 'Foo',
|
||||
'catalognumber' : 'Foo',
|
||||
'barcode' : 'Foo',
|
||||
'encodedby' : 'Foo',
|
||||
'albumsort' : 'Foo',
|
||||
'albumartistsort' : 'Foo',
|
||||
'artistsort' : 'Foo',
|
||||
'titlesort' : 'Foo',
|
||||
'composersort' : 'Foo',
|
||||
'showsort' : 'Foo',
|
||||
'musicbrainz_trackid' : 'Foo',
|
||||
'musicbrainz_albumid' : 'Foo',
|
||||
'musicbrainz_artistid' : 'Foo',
|
||||
'musicbrainz_albumartistid' : 'Foo',
|
||||
'musicbrainz_trmid' : 'Foo',
|
||||
'musicbrainz_discid' : 'Foo',
|
||||
'musicip_puid' : 'Foo',
|
||||
'musicip_fingerprint' : 'Foo',
|
||||
'releasestatus' : 'Foo',
|
||||
'releasetype' : 'Foo',
|
||||
'asin' : 'Foo',
|
||||
'gapless' : '1',
|
||||
'podcast' : '1',
|
||||
'podcasturl' : 'Foo',
|
||||
'show' : 'Foo',
|
||||
}
|
||||
#'comment:foo': 'Foo',
|
||||
'genre': 'Foo',
|
||||
'bpm': '80',
|
||||
'mood': 'Foo',
|
||||
'isrc': 'Foo',
|
||||
'copyright': 'Foo',
|
||||
'lyrics': 'Foo',
|
||||
'media': 'Foo',
|
||||
'label': 'Foo',
|
||||
'catalognumber': 'Foo',
|
||||
'barcode': 'Foo',
|
||||
'encodedby': 'Foo',
|
||||
'albumsort': 'Foo',
|
||||
'albumartistsort': 'Foo',
|
||||
'artistsort': 'Foo',
|
||||
'titlesort': 'Foo',
|
||||
'composersort': 'Foo',
|
||||
'showsort': 'Foo',
|
||||
'musicbrainz_trackid': 'Foo',
|
||||
'musicbrainz_albumid': 'Foo',
|
||||
'musicbrainz_artistid': 'Foo',
|
||||
'musicbrainz_albumartistid': 'Foo',
|
||||
'musicbrainz_trmid': 'Foo',
|
||||
'musicbrainz_discid': 'Foo',
|
||||
'musicip_puid': 'Foo',
|
||||
'musicip_fingerprint': 'Foo',
|
||||
'releasestatus': 'Foo',
|
||||
'releasetype': 'Foo',
|
||||
'asin': 'Foo',
|
||||
'gapless': '1',
|
||||
'podcast': '1',
|
||||
'podcasturl': 'Foo',
|
||||
'show': 'Foo',
|
||||
}
|
||||
|
||||
|
||||
class WavPackTest(FormatsTest):
|
||||
original = os.path.join('test', 'data', 'test.wv')
|
||||
supports_ratings = False
|
||||
tags = {
|
||||
'album' : 'Foo Bar',
|
||||
'album' : '1',
|
||||
'title' : 'Foo',
|
||||
'artist' : 'Foo',
|
||||
'albumartist' : 'Foo',
|
||||
'date' : '2004',
|
||||
#'originaldate' : '1980',
|
||||
'artist' : 'Foo',
|
||||
'composer' : 'Foo',
|
||||
'lyricist' : 'Foo',
|
||||
'conductor' : 'Foo',
|
||||
'performer:guest vocal' : 'Foo',
|
||||
'remixer' : 'Foo',
|
||||
'arranger' : 'Foo',
|
||||
'engineer' : 'Foo',
|
||||
'producer' : 'Foo',
|
||||
'djmixer' : 'Foo',
|
||||
'mixer' : 'Foo',
|
||||
'grouping' : 'Foo',
|
||||
'subtitle' : 'Foo',
|
||||
'discsubtitle' : 'Foo',
|
||||
'tracknumber' : '2',
|
||||
'totaltracks' : '10',
|
||||
'discnumber' : '1',
|
||||
'totaldiscs' : '2',
|
||||
'compilation' : '1',
|
||||
'comment:' : 'Foo',
|
||||
'comment:foo' : 'Foo',
|
||||
'genre' : 'Foo',
|
||||
'bpm' : '80',
|
||||
'mood' : 'Foo',
|
||||
'isrc' : 'Foo',
|
||||
'copyright' : 'Foo',
|
||||
'lyrics' : 'Foo',
|
||||
'media' : 'Foo',
|
||||
'label' : 'Foo',
|
||||
'catalognumber' : 'Foo',
|
||||
'barcode' : 'Foo',
|
||||
'encodedby' : 'Foo',
|
||||
'albumsort' : 'Foo',
|
||||
'albumartistsort' : 'Foo',
|
||||
'artistsort' : 'Foo',
|
||||
'titlesort' : 'Foo',
|
||||
#'composersort' : 'Foo',
|
||||
#'showsort' : 'Foo',
|
||||
'musicbrainz_trackid' : 'Foo',
|
||||
'musicbrainz_albumid' : 'Foo',
|
||||
'musicbrainz_artistid' : 'Foo',
|
||||
'musicbrainz_albumartistid' : 'Foo',
|
||||
'musicbrainz_trmid' : 'Foo',
|
||||
'musicbrainz_discid' : 'Foo',
|
||||
'musicip_puid' : 'Foo',
|
||||
#'musicip_fingerprint' : 'Foo',
|
||||
'releasestatus' : 'Foo',
|
||||
'releasetype' : 'Foo',
|
||||
'asin' : 'Foo',
|
||||
#'gapless' : '1',
|
||||
#'podcast' : '1',
|
||||
#'podcasturl' : 'Foo',
|
||||
#'show' : 'Foo',
|
||||
}
|
||||
'album': 'Foo Bar',
|
||||
'album': '1',
|
||||
'title': 'Foo',
|
||||
'artist': 'Foo',
|
||||
'albumartist': 'Foo',
|
||||
'date': '2004',
|
||||
#'originaldate': '1980',
|
||||
'artist': 'Foo',
|
||||
'composer': 'Foo',
|
||||
'lyricist': 'Foo',
|
||||
'conductor': 'Foo',
|
||||
'performer:guest vocal': 'Foo',
|
||||
'remixer': 'Foo',
|
||||
'arranger': 'Foo',
|
||||
'engineer': 'Foo',
|
||||
'producer': 'Foo',
|
||||
'djmixer': 'Foo',
|
||||
'mixer': 'Foo',
|
||||
'grouping': 'Foo',
|
||||
'subtitle': 'Foo',
|
||||
'discsubtitle': 'Foo',
|
||||
'tracknumber': '2',
|
||||
'totaltracks': '10',
|
||||
'discnumber': '1',
|
||||
'totaldiscs': '2',
|
||||
'compilation': '1',
|
||||
'comment:': 'Foo',
|
||||
'comment:foo': 'Foo',
|
||||
'genre': 'Foo',
|
||||
'bpm': '80',
|
||||
'mood': 'Foo',
|
||||
'isrc': 'Foo',
|
||||
'copyright': 'Foo',
|
||||
'lyrics': 'Foo',
|
||||
'media': 'Foo',
|
||||
'label': 'Foo',
|
||||
'catalognumber': 'Foo',
|
||||
'barcode': 'Foo',
|
||||
'encodedby': 'Foo',
|
||||
'albumsort': 'Foo',
|
||||
'albumartistsort': 'Foo',
|
||||
'artistsort': 'Foo',
|
||||
'titlesort': 'Foo',
|
||||
#'composersort': 'Foo',
|
||||
#'showsort': 'Foo',
|
||||
'musicbrainz_trackid': 'Foo',
|
||||
'musicbrainz_albumid': 'Foo',
|
||||
'musicbrainz_artistid': 'Foo',
|
||||
'musicbrainz_albumartistid': 'Foo',
|
||||
'musicbrainz_trmid': 'Foo',
|
||||
'musicbrainz_discid': 'Foo',
|
||||
'musicip_puid': 'Foo',
|
||||
#'musicip_fingerprint': 'Foo',
|
||||
'releasestatus': 'Foo',
|
||||
'releasetype': 'Foo',
|
||||
'asin': 'Foo',
|
||||
#'gapless': '1',
|
||||
#'podcast': '1',
|
||||
#'podcasturl': 'Foo',
|
||||
#'show': 'Foo',
|
||||
}
|
||||
|
||||
|
||||
class TestCoverArt(unittest.TestCase):
|
||||
@@ -532,8 +531,14 @@ class TestCoverArt(unittest.TestCase):
|
||||
# This checks a mutagen error with ASF files.
|
||||
dummyload = "a" * 1024 * 128
|
||||
tests = {
|
||||
'jpg': {'mime': 'image/jpeg', 'head': 'JFIF'},
|
||||
'png': {'mime': 'image/png', 'head': 'PNG'},
|
||||
'jpg': {
|
||||
'mime': 'image/jpeg',
|
||||
'head': 'JFIF'
|
||||
},
|
||||
'png': {
|
||||
'mime': 'image/png',
|
||||
'head': 'PNG'
|
||||
},
|
||||
}
|
||||
for t in tests:
|
||||
f = picard.formats.open(self.filename)
|
||||
|
||||
@@ -38,8 +38,10 @@ class TrackTest(unittest.TestCase):
|
||||
|
||||
def test_1(self):
|
||||
config.setting = settings
|
||||
|
||||
class Track:
|
||||
pass
|
||||
|
||||
node = XmlNode(children={
|
||||
'title': [XmlNode(text='Foo')],
|
||||
'length': [XmlNode(text='180000')],
|
||||
@@ -78,6 +80,7 @@ class TrackTest(unittest.TestCase):
|
||||
self.assertEqual('workid123', m['musicbrainz_workid'])
|
||||
self.assertEqual('eng', m['language'])
|
||||
|
||||
|
||||
class ReleaseTest(unittest.TestCase):
|
||||
|
||||
def test_1(self):
|
||||
|
||||
@@ -41,40 +41,40 @@ class ScriptParserTest(unittest.TestCase):
|
||||
context = Metadata()
|
||||
context["source"] = ["multi", "valued"]
|
||||
self.parser.eval("$set(test,%source%)", context)
|
||||
self.assertEqual(context.getall("test"), ["multi; valued"]) # list has only a single value
|
||||
self.assertEqual(context.getall("test"), ["multi; valued"]) # list has only a single value
|
||||
|
||||
def test_cmd_setmulti_multi_valued(self):
|
||||
context = Metadata()
|
||||
context["source"] = ["multi", "valued"]
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,%source%)", context)) # no return value
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,%source%)", context)) # no return value
|
||||
self.assertEqual(context.getall("source"), context.getall("test"))
|
||||
|
||||
def test_cmd_setmulti_multi_valued_wth_spaces(self):
|
||||
context = Metadata()
|
||||
context["source"] = ["multi, multi", "valued, multi"]
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,%source%)", context)) # no return value
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,%source%)", context)) # no return value
|
||||
self.assertEqual(context.getall("source"), context.getall("test"))
|
||||
|
||||
def test_cmd_setmulti_not_multi_valued(self):
|
||||
context = Metadata()
|
||||
context["source"] = "multi, multi"
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,%source%)", context)) # no return value
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,%source%)", context)) # no return value
|
||||
self.assertEqual(context.getall("source"), context.getall("test"))
|
||||
|
||||
def test_cmd_setmulti_will_remove_empty_items(self):
|
||||
context = Metadata()
|
||||
context["source"] = ["", "multi", ""]
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,%source%)", context)) # no return value
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,%source%)", context)) # no return value
|
||||
self.assertEqual(["multi"], context.getall("test"))
|
||||
|
||||
def test_cmd_setmulti_custom_splitter_string(self):
|
||||
context = Metadata()
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,multi##valued##test##,##)", context)) # no return value
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,multi##valued##test##,##)", context)) # no return value
|
||||
self.assertEqual(["multi", "valued", "test"], context.getall("test"))
|
||||
|
||||
def test_cmd_setmulti_empty_splitter_does_nothing(self):
|
||||
context = Metadata()
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,multi; valued,)", context)) # no return value
|
||||
self.assertEqual("", self.parser.eval("$setmulti(test,multi; valued,)", context)) # no return value
|
||||
self.assertEqual(["multi; valued"], context.getall("test"))
|
||||
|
||||
def test_cmd_get(self):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import unittest
|
||||
from picard.similarity import similarity
|
||||
|
||||
|
||||
class SimilarityTest(unittest.TestCase):
|
||||
|
||||
def test_correct(self):
|
||||
self.assertEqual(similarity(u"K!", u"K!"), 1.0)
|
||||
self.assertEqual(similarity(u"BBB", u"AAA"), 0.0)
|
||||
self.assertAlmostEqual(similarity(u"ABC", u"ABB"), 0.7, 1)
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ class SanitizeDateTest(unittest.TestCase):
|
||||
self.assertNotEqual(util.sanitize_date("2006--02"), "2006-02")
|
||||
self.assertNotEqual(util.sanitize_date("2006.03.02"), "2006-03-02")
|
||||
|
||||
|
||||
class ShortFilenameTest(unittest.TestCase):
|
||||
|
||||
def test_short(self):
|
||||
@@ -103,15 +104,15 @@ class TranslateArtistTest(unittest.TestCase):
|
||||
self.assertNotEqual(u"Tchaikovsky, Pyotr Ilyich", util.translate_from_sortname(u"Пётр Ильич Чайковский", u"Tchaikovsky, Pyotr Ilyich"))
|
||||
self.assertNotEqual(u"Пётр Ильич Чайковский", util.translate_from_sortname(u"Пётр Ильич Чайковский", u"Tchaikovsky, Pyotr Ilyich"))
|
||||
|
||||
|
||||
|
||||
class FormatTimeTest(unittest.TestCase):
|
||||
|
||||
def test(self):
|
||||
self.assertEqual("?:??", util.format_time(0))
|
||||
self.assertEqual("3:00", util.format_time(179750))
|
||||
self.assertEqual("3:00", util.format_time(179500))
|
||||
self.assertEqual("2:59", util.format_time(179499))
|
||||
|
||||
def test(self):
|
||||
self.assertEqual("?:??", util.format_time(0))
|
||||
self.assertEqual("3:00", util.format_time(179750))
|
||||
self.assertEqual("3:00", util.format_time(179500))
|
||||
self.assertEqual("2:59", util.format_time(179499))
|
||||
|
||||
|
||||
class LoadReleaseTypeScoresTest(unittest.TestCase):
|
||||
|
||||
@@ -141,4 +142,3 @@ class SaveReleaseTypeScoresTest(unittest.TestCase):
|
||||
self.assertTrue("Single 0.50" in saved_scores)
|
||||
self.assertTrue("Other 0.00" in saved_scores)
|
||||
self.assertEqual(6, len(saved_scores.split()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user