本文整理汇总了Python中miro.playlist.SavedPlaylist.reorder方法的典型用法代码示例。如果您正苦于以下问题:Python SavedPlaylist.reorder方法的具体用法?Python SavedPlaylist.reorder怎么用?Python SavedPlaylist.reorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类miro.playlist.SavedPlaylist
的用法示例。
在下文中一共展示了SavedPlaylist.reorder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PlaylistFolderTestCase
# 需要导入模块: from miro.playlist import SavedPlaylist [as 别名]
# 或者: from miro.playlist.SavedPlaylist import reorder [as 别名]
class PlaylistFolderTestCase(PlaylistTestBase):
def setUp(self):
PlaylistTestBase.setUp(self)
self.playlistTabOrder = tabs.TabOrder(u'playlist')
self.p1 = SavedPlaylist(u"rocketboom", [self.i1.id, self.i3.id])
self.p2 = SavedPlaylist(u"telemusicvision", [self.i4.id, self.i3.id])
self.p3 = SavedPlaylist(u"digg", [self.i1.id, self.i2.id,
self.i3.id, self.i4.id])
self.folder = PlaylistFolder(u"My Best Vids")
self.p1.set_folder(self.folder)
self.p2.set_folder(self.folder)
self.p3.set_folder(self.folder)
def check_list(self, correct_order):
correct_ids = [item.id for item in correct_order]
actual_ids = list(i.id for i in
Item.playlist_folder_view(self.folder.id))
self.assertEquals(actual_ids, correct_ids)
def test_add_playlists(self):
self.check_list([self.i1, self.i3, self.i4, self.i2])
def test_change_folder(self):
self.p3.set_folder(None)
self.check_list([self.i1, self.i3, self.i4])
self.p2.set_folder(None)
self.check_list([self.i1, self.i3])
self.p1.set_folder(None)
self.check_list([])
def test_remove_playlist(self):
self.p3.remove()
self.check_list([self.i1, self.i3, self.i4])
self.p2.remove()
self.check_list([self.i1, self.i3])
self.p1.remove()
self.check_list([])
def test_remove_items_from_playlist(self):
self.p3.remove_item(self.i2)
self.check_list([self.i1, self.i3, self.i4])
self.p3.remove_item(self.i3)
# i3 is still in other children of self.folder, so it
# shouldn't be removed
self.check_list([self.i1, self.i3, self.i4])
def test_order_independent(self):
self.p3.reorder([self.i4.id, self.i2.id, self.i3.id, self.i1.id])
self.check_list([self.i1, self.i3, self.i4, self.i2])
self.folder.reorder([self.i4.id, self.i3.id, self.i2.id, self.i1.id])
self.check_list([self.i4, self.i3, self.i2, self.i1])
def test_remove_folder_removes_playlist(self):
self.folder.remove()
self.assertEquals(SavedPlaylist.make_view().count(), 0)
示例2: test_basic_operations
# 需要导入模块: from miro.playlist import SavedPlaylist [as 别名]
# 或者: from miro.playlist.SavedPlaylist import reorder [as 别名]
def test_basic_operations(self):
playlist = SavedPlaylist(u"rocketboom")
self.assertEquals(playlist.get_title(), u'rocketboom')
self.check_list(playlist, [])
playlist.add_item(self.i4)
playlist.add_item(self.i1)
playlist.add_item(self.i3)
playlist.add_item(self.i2)
self.check_list(playlist, [self.i4, self.i1, self.i3, self.i2])
playlist.add_item(self.i2)
self.check_list(playlist, [self.i4, self.i1, self.i3, self.i2])
self.assert_(self.i1.keep)
self.assert_(self.i2.keep)
self.assert_(self.i3.keep)
self.assert_(self.i4.keep)
playlist.remove_item(self.i2)
self.check_list(playlist, [self.i4, self.i1, self.i3])
playlist.reorder([self.i3.id, self.i4.id, self.i1.id])
self.check_list(playlist, [self.i3, self.i4, self.i1])
playlist.remove_item(self.i3)
self.check_list(playlist, [self.i4, self.i1])