本文整理汇总了Python中playlist.Playlist.dasherize_name方法的典型用法代码示例。如果您正苦于以下问题:Python Playlist.dasherize_name方法的具体用法?Python Playlist.dasherize_name怎么用?Python Playlist.dasherize_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类playlist.Playlist
的用法示例。
在下文中一共展示了Playlist.dasherize_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestPLaylist
# 需要导入模块: from playlist import Playlist [as 别名]
# 或者: from playlist.Playlist import dasherize_name [as 别名]
class TestPLaylist(unittest.TestCase):
def setUp(self):
self.playlist = Playlist("Dolna Chalga", False, False)
self.song = Song("Bout Me", "Wiz Khalifa", "Cabin Fever", "3:30")
self.song1 = Song("Bout Meee", "Wwwwiz Khalifa", "Cabin Ffever", "4:30")
self.song2 = Song("Bouttt Me", "Wiz Khaliiifa", "Cabinnn Fever", "5:30")
def test_playlist_dasherize_name(self):
self.assertEqual(self.playlist.dasherize_name(), "Dolna-Chalga")
def test_playlist_add_one_song(self):
self.playlist.add_songs(self.song)
self.assertIn(self.song, self.playlist.list)
def test_playlist_add_list_of_songs(self):
self.playlist.add_songs([self.song, self.song1, self.song2])
self.assertIn(self.song1, self.playlist.list)
def test_playlist_add_non_song(self):
with self.assertRaises(TypeError):
self.playlist.add_songs("should fail")
def test_playlist_remove_song(self):
self.playlist.add_songs([self.song, self.song1, self.song2])
self.playlist.remove_song(self.song1)
self.assertNotIn(self.song1, self.playlist.list)
def test_playlist_remove_unexisting_song(self):
self.playlist.add_songs([self.song, self.song1])
self.assertEqual(self.playlist.remove_song(self.song2), "There is no such song in the playlist.")
def test_playlist_total_length(self):
self.playlist.add_songs([self.song, self.song1, self.song2])
self.assertEqual(self.playlist.total_length(), "0:13:30")
def test_playlist_artists(self):
#It was easier to be tested in REPL. Everything's ok.
pass