本文整理汇总了Python中playlist.Playlist.str_func方法的典型用法代码示例。如果您正苦于以下问题:Python Playlist.str_func方法的具体用法?Python Playlist.str_func怎么用?Python Playlist.str_func使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类playlist.Playlist
的用法示例。
在下文中一共展示了Playlist.str_func方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_str
# 需要导入模块: from playlist import Playlist [as 别名]
# 或者: from playlist.Playlist import str_func [as 别名]
def test_str(self):
new_playlist = Playlist("my_playlist")
enter_song = Song("Enter sandman", "Metallica", "Balck album", 2, 300, 192)
harvester_song = Song("Harvester of sorrow", "Metallica", "...And justice for all",3 , 300, 150)
new_playlist = Playlist("my_playlist")
new_playlist.songs.append(harvester_song)
new_playlist.songs.append(enter_song)
expected_string = "Metallica - Harvester of sorrow 300\nMetallica - Enter sandman 300\n"
self.assertEqual(expected_string, new_playlist.str_func())
示例2: main
# 需要导入模块: from playlist import Playlist [as 别名]
# 或者: from playlist.Playlist import str_func [as 别名]
def main():
#new_songs_arr = []
print(start_message())
print(songs_to_add())
new_playlist = Playlist("my_playlist")
while True:
command = split_command_str(input("Enter command>"))
if the_command(command, "generate"):
new_crawler = Music_crawler(command[1])
new_playlist = new_crawler.generate_playlist()
print(new_playlist.str_func())
elif the_command(command, "remove_disrated"):
new_playlist.remove_disrated(int(command[1]))
print(new_playlist.str_func())
elif the_command(command, "remove_bad_quality"):
new_playlist.remove_bad_quality()
print(new_playlist.str_func())
elif the_command(command, "remove"):
new_playlist.remove_song(command[1])
print(new_playlist.str_func())
elif the_command(command, "add"):
for song in songs_arr:
if command[1] == song.title:
new_playlist.add_song(song)
break
print(new_playlist.str_func())
elif the_command(command, "load"):
new_playlist.load(command[1])
print(new_playlist.str_func())
elif the_command(command, "save"):
new_playlist.save(command[1])
elif the_command(command, "finish"):
print("GoodBye. Thank you for using the player")
break
else:
print(unknown_command())
示例3: test_empty_str
# 需要导入模块: from playlist import Playlist [as 别名]
# 或者: from playlist.Playlist import str_func [as 别名]
def test_empty_str(self):
new_playlist = Playlist("my_playlist")
expected_string = ""
self.assertEqual(expected_string, new_playlist.str_func())