Esempio n. 1
0
    def from_json(cls, json_dict):
        playlist = cls(name=json_dict["name"],
                       repeat=json_dict["repeat"],
                       shuffle=json_dict["shuffle"])

        for song_as_json in json_dict["songs"]:
            playlist.add_song(Song.from_json(song_as_json))

        return playlist
Esempio n. 2
0
    def test_from_json(self):
        json_dict = {
            "title": "Odin",
            "artist": "Manowar",
            "album": "The Sons of Odin",
            "length": "03:44"
        }

        self.assertEqual(self.song, Song.from_json(json_dict))