def test_as_track(self): l = Link.from_string("spotify:track:test_track") t = l.as_track() self.assertEqual(str(t), "track")
def test_as_album(self): l = Link.from_string("spotify:album:test_album") t = l.as_album() self.assertEqual(str(t), "album")
def test_str(self): s = "str_test" l = Link.from_string(s) self.assertEqual(str(l), "link:str_test")
def test_from_string(self): s = "spotify:artist:test" l = Link.from_string(s) self.assertEqual(str(l), "spotify:artist:test")
def test_as_album_badlink(self): l = Link.from_string("NOTalbum:as_album_test") self.assertRaises(SpotifyError, l.as_album)
def test_as_artist_badlink(self): l = Link.from_string("NOTartist:test_as_artist") self.assertRaises(SpotifyError, l.as_artist)
def test_as_track_badlink(self): l = Link.from_string("NOTtrack:as_track_test") self.assertRaises(SpotifyError, l.as_track)
def test_as_track(self): l = Link.from_string("track:as_track_test") t = l.as_track() self.assertEqual(str(t), "as_track_test")
def test_as_album(self): l = Link.from_string("album:as_album_test") t = l.as_album() self.assertEqual(str(t), "as_album_test")
def test_as_artist(self): l = Link.from_string("spotify:artist:test_artist") a = l.as_artist() self.assertEqual(str(a), "artist")
def test_as_string(self): s = "spotify:track:str_test" l = Link.from_string(s) self.assertEqual(str(l), "spotify:track:str_test")