本文整理汇总了Python中miro.playlist.SavedPlaylist.make_view方法的典型用法代码示例。如果您正苦于以下问题:Python SavedPlaylist.make_view方法的具体用法?Python SavedPlaylist.make_view怎么用?Python SavedPlaylist.make_view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类miro.playlist.SavedPlaylist
的用法示例。
在下文中一共展示了SavedPlaylist.make_view方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_live_storage_converts
# 需要导入模块: from miro.playlist import SavedPlaylist [as 别名]
# 或者: from miro.playlist.SavedPlaylist import make_view [as 别名]
def test_live_storage_converts(self):
# FIXME - this test fails on Windows. I'm pretty sure we need
# a Windows-specific predbupgrade88 because the databases are
# platform specific.
if self.on_windows():
self.assert_(False, "test_live_storage_converts fails on windows")
# run upgrade 88
old_db_path = resources.path("testdata/olddatabase.predbupgrade88")
shutil.copyfile(old_db_path, self.tmp_path)
self.reload_database(self.tmp_path)
app.db.upgrade_database()
# figure out which maps were created
folder_maps = set()
playlist_maps = set()
for map in PlaylistFolderItemMap.make_view():
folder_maps.add((map.playlist_id, map.item_id, map.position,
map.count))
self.assert_(map.id is not None)
for map in PlaylistItemMap.make_view():
playlist_maps.add((map.playlist_id, map.item_id, map.position))
self.assert_(map.id is not None)
playlist1 = SavedPlaylist.make_view("title='playlist1'").get_singleton()
playlist2 = SavedPlaylist.make_view("title='playlist2'").get_singleton()
folder = PlaylistFolder.make_view().get_singleton()
# Double check that we have the right item ids
self.assertEquals(Item.get_by_id(242).get_title(),
u"Berliner Brats n' Kraut")
self.assertEquals(Item.get_by_id(240).get_title(),
u"White Bean & Basil Bruschetta")
self.assertEquals(Item.get_by_id(79).get_title(), u"Meet the GIMP!")
self.assertEquals(Item.get_by_id(69).get_title(),
u"Delicious TV Vegetarian (video)")
# check that folder contains playlist 1
self.assertEquals(playlist1.folder_id, folder.id)
self.assertEquals(playlist2.folder_id, folder.id)
# Check that the playlist maps follow the following structure:
#
# folder1:
# - Berliner Brats n' Kraut (id: 242)
# - White Bean & Basil Bruschetta (id: 240)
# - Meet the GIMP! (id: 79)
# - Delicious TV Vegetarian (video) (id: 69)
# playlist1
# - White Bean & Basil Bruschetta (id: 240)
# - Berliner Brats n' Kraut (id: 242)
# playlist2
# - Meet the GIMP! (id: 79)
# - Delicious TV Vegetarian (video) (id: 69)
# - White Bean & Basil Bruschetta (id: 240)
self.assertEquals(folder_maps, set([
(folder.id, 242, 0, 1),
(folder.id, 240, 1, 2),
(folder.id, 79, 2, 1),
(folder.id, 69, 3, 1),
]))
self.assertEquals(playlist_maps, set([
(playlist1.id, 240, 0),
(playlist1.id, 242, 1),
(playlist2.id, 79, 0),
(playlist2.id, 69, 1),
(playlist2.id, 240, 2),
]))
示例2: test_remove_folder_removes_playlist
# 需要导入模块: from miro.playlist import SavedPlaylist [as 别名]
# 或者: from miro.playlist.SavedPlaylist import make_view [as 别名]
def test_remove_folder_removes_playlist(self):
self.folder.remove()
self.assertEquals(SavedPlaylist.make_view().count(), 0)