Example #1
0
    def test_sort_artist(self):
        a = self._get_album({"album": "b", "artist": "x"})
        b = self._get_album({"album": "a", "artist": "y"})
        c = self._get_album({"album": "a", "artist": ""})
        n = self._get_album({"album": ""})

        self.assertOrder(compare_artist, [AlbumItem(None), a, b, c, n])
Example #2
0
    def test_sort_rating(self):
        a = self._get_album({"album": "b", "~#rating": 0.5})
        b = self._get_album({"album": "a", "~#rating": 0.25})
        c = self._get_album({"album": "x", "~#rating": 0.0})
        n = self._get_album({"album": "", "~#rating": 0.25})

        self.assertOrder(compare_rating, [AlbumItem(None), a, b, c, n])
Example #3
0
    def test_sort_date(self):
        a = self._get_album({"album": "b", "date": "1970"})
        b = self._get_album({"album": "a", "date": "2038"})
        c = self._get_album({"album": "a", "date": ""})
        n = self._get_album({"album": ""})

        self.assertOrder(compare_date, [AlbumItem(None), a, b, c, n])
    def test_sort_original_date(self):
        a = self._get_album({"album": "b", "date": "1970"})
        b = self._get_album({"album": "a", "date": "2038",
                             "originaldate": "1967"})
        c = self._get_album({"album": "a", "date": ""})
        d = self._get_album({"album": "b", "originaldate": "1971"})
        n = self._get_album({"album": ""})

        self.assertOrder(compare_original_date,
                         [AlbumItem(None), b, a, d, c, n])
Example #5
0
    def test_sort_title(self):
        a = self._get_album({"album": "a"})
        b = self._get_album({"album": "b"})
        n = self._get_album({"album": ""})

        self.assertOrder(compare_title, [AlbumItem(None), a, b, n])
Example #6
0
 def _get_album(self, dict_):
     song = AudioFile(dict_)
     album = Album(song)
     album.songs.add(song)
     return AlbumItem(album)