本文整理匯總了Python中Playlist.Playlist.show_artists方法的典型用法代碼示例。如果您正苦於以下問題:Python Playlist.show_artists方法的具體用法?Python Playlist.show_artists怎麽用?Python Playlist.show_artists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Playlist.Playlist
的用法示例。
在下文中一共展示了Playlist.show_artists方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Test_playlist
# 需要導入模塊: from Playlist import Playlist [as 別名]
# 或者: from Playlist.Playlist import show_artists [as 別名]
class Test_playlist(unittest.TestCase):
def setUp(self):
self.testplaylist = Playlist("Test Playlist")
self.song = Song("Title", "Artist", "Album", 5, 20, 120)
self.song1 = Song("Title1", "Artist", "Album1", 1, 20, 50)
self.song2 = Song("Title2", "Artist1", "Album1", 1, 20, 100)
self.testplaylist.add_song(self.song)
self.testplaylist.add_song(self.song1)
self.testplaylist.add_song(self.song2)
def test_playlist_init(self):
self.assertEqual(self.testplaylist.name, "Test Playlist")
def test_playlist(self):
self.assertEqual(self.testplaylist.songs[0], self.song)
def test_remove_song(self):
self.testplaylist.remove_song("Title1")
self.assertEqual(self.testplaylist.songs[0], self.song)
self.assertEqual(self.testplaylist.songs[1], self.song2)
def test_total_length(self):
self.assertEqual(self.testplaylist.total_length(), 60)
def test_remove_disrated(self):
self.testplaylist.remove_disrated(4)
self.assertEqual(self.testplaylist.songs[0], self.song)
def test_remove_bad_quality(self):
self.testplaylist.remove_bad_quality()
self.assertEqual(self.testplaylist.songs[0], self.song)
self.assertEqual(self.testplaylist.songs[1], self.song2)
def test_show_artists(self):
artists = ["Artist", "Artist1"]
self.assertSetEqual(self.testplaylist.show_artists(), set(artists))