當前位置: 首頁>>代碼示例>>Python>>正文


Python Playlist.remove_disrated方法代碼示例

本文整理匯總了Python中Playlist.Playlist.remove_disrated方法的典型用法代碼示例。如果您正苦於以下問題:Python Playlist.remove_disrated方法的具體用法?Python Playlist.remove_disrated怎麽用?Python Playlist.remove_disrated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Playlist.Playlist的用法示例。


在下文中一共展示了Playlist.remove_disrated方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Test_playlist

# 需要導入模塊: from Playlist import Playlist [as 別名]
# 或者: from Playlist.Playlist import remove_disrated [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))
開發者ID:VasilVasilev93,項目名稱:HackBulgaria,代碼行數:39,代碼來源:Playlist_test.py


注:本文中的Playlist.Playlist.remove_disrated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。